1
0
Fork 0
forked from vv/efemra

I think it works now!!!!

This commit is contained in:
Vivianne 2022-07-22 03:21:53 -07:00
parent 7e026b8041
commit 74e0a48ea5
4 changed files with 15 additions and 7 deletions

View file

@ -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;

View file

@ -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;
}
};

View file

@ -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,

View file

@ -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;
}