diff --git a/src/rendering/vulkan/framebuffer.zig b/src/rendering/vulkan/framebuffer.zig index c3fe27c..410313f 100644 --- a/src/rendering/vulkan/framebuffer.zig +++ b/src/rendering/vulkan/framebuffer.zig @@ -49,7 +49,6 @@ pub fn getOrAdd(device: *const Device, attachments: []*const Image, width: u32, .height = @intCast(u16, height), }; - std.debug.print("# attachments: {}\n\n", .{attachments.len}); for (attachments) |attachment, i| { assert(attachment.view != .null_handle); key.attachments[i] = attachment.view; diff --git a/src/rendering/vulkan/image.zig b/src/rendering/vulkan/image.zig index 35d1bda..dfa2a4b 100644 --- a/src/rendering/vulkan/image.zig +++ b/src/rendering/vulkan/image.zig @@ -52,8 +52,10 @@ pub const Image = struct { self.handle = handle; self.image_type = info.image_type; self.format = info.format; - self.state = State{}; - self.state.layout = info.initial_layout; + self.state = State{ + .layout = info.initial_layout, + .stage = .{ .color_attachment_output_bit = true }, // possibly needed + }; self.usage = info.usage; self.width = @intCast(u16, info.extent.width); self.height = @intCast(u16, info.extent.height); @@ -343,7 +345,6 @@ pub const Image = struct { (try Command.Buffer.get(self.owner, device)).touchImage(img); assert(img.state.layout == self.layout); - std.debug.print("inserted barrier: {}\n", .{inserted_barrier}); return inserted_barrier; } }; diff --git a/src/rendering/vulkan/queues.zig b/src/rendering/vulkan/queues.zig index 3d2bfa9..584f826 100644 --- a/src/rendering/vulkan/queues.zig +++ b/src/rendering/vulkan/queues.zig @@ -15,7 +15,11 @@ const sync = @import("sync.zig"); var gpa = std.heap.GeneralPurposeAllocator(.{}){}; const allocator = gpa.allocator(); -const present_stages: vk.PipelineStageFlags = .{ .all_commands_bit = true, .top_of_pipe_bit = true, .bottom_of_pipe_bit = true }; +const present_stages: vk.PipelineStageFlags = .{ + .all_commands_bit = true, + .top_of_pipe_bit = true, + .bottom_of_pipe_bit = true, +}; const present_access: vk.AccessFlags = .{ .memory_read_bit = true, .memory_write_bit = true, diff --git a/src/rendering/vulkan/swapchain.zig b/src/rendering/vulkan/swapchain.zig index 2bfb3ae..7be5c48 100644 --- a/src/rendering/vulkan/swapchain.zig +++ b/src/rendering/vulkan/swapchain.zig @@ -352,14 +352,18 @@ pub const Swapchain = struct { return @intToFloat(f32, self.width) / @intToFloat(f32, self.height); } + pub fn getSwapIndex(self: *const Self) usize { + return self.image_index; + } + pub fn getBackBufferRO(self: *const Self) *const Image { - const img = &self.images[self.image_index]; + const img = &self.images[self.getSwapIndex()]; assert(img.handle != .null_handle); return img; } pub fn getBackBuffer(self: *Self) *Image { - var img = &self.images[self.image_index]; + var img = &self.images[self.getSwapIndex()]; assert(img.handle != .null_handle); return img; }