I think it works now!!!!
This commit is contained in:
parent
7e026b8041
commit
74e0a48ea5
|
@ -49,7 +49,6 @@ pub fn getOrAdd(device: *const Device, attachments: []*const Image, width: u32,
|
||||||
.height = @intCast(u16, height),
|
.height = @intCast(u16, height),
|
||||||
};
|
};
|
||||||
|
|
||||||
std.debug.print("# attachments: {}\n\n", .{attachments.len});
|
|
||||||
for (attachments) |attachment, i| {
|
for (attachments) |attachment, i| {
|
||||||
assert(attachment.view != .null_handle);
|
assert(attachment.view != .null_handle);
|
||||||
key.attachments[i] = attachment.view;
|
key.attachments[i] = attachment.view;
|
||||||
|
|
|
@ -52,8 +52,10 @@ pub const Image = struct {
|
||||||
self.handle = handle;
|
self.handle = handle;
|
||||||
self.image_type = info.image_type;
|
self.image_type = info.image_type;
|
||||||
self.format = info.format;
|
self.format = info.format;
|
||||||
self.state = State{};
|
self.state = State{
|
||||||
self.state.layout = info.initial_layout;
|
.layout = info.initial_layout,
|
||||||
|
.stage = .{ .color_attachment_output_bit = true }, // possibly needed
|
||||||
|
};
|
||||||
self.usage = info.usage;
|
self.usage = info.usage;
|
||||||
self.width = @intCast(u16, info.extent.width);
|
self.width = @intCast(u16, info.extent.width);
|
||||||
self.height = @intCast(u16, info.extent.height);
|
self.height = @intCast(u16, info.extent.height);
|
||||||
|
@ -343,7 +345,6 @@ pub const Image = struct {
|
||||||
(try Command.Buffer.get(self.owner, device)).touchImage(img);
|
(try Command.Buffer.get(self.owner, device)).touchImage(img);
|
||||||
assert(img.state.layout == self.layout);
|
assert(img.state.layout == self.layout);
|
||||||
|
|
||||||
std.debug.print("inserted barrier: {}\n", .{inserted_barrier});
|
|
||||||
return inserted_barrier;
|
return inserted_barrier;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -15,7 +15,11 @@ const sync = @import("sync.zig");
|
||||||
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
|
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
|
||||||
const allocator = gpa.allocator();
|
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 = .{
|
const present_access: vk.AccessFlags = .{
|
||||||
.memory_read_bit = true,
|
.memory_read_bit = true,
|
||||||
.memory_write_bit = true,
|
.memory_write_bit = true,
|
||||||
|
|
|
@ -352,14 +352,18 @@ pub const Swapchain = struct {
|
||||||
return @intToFloat(f32, self.width) / @intToFloat(f32, self.height);
|
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 {
|
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);
|
assert(img.handle != .null_handle);
|
||||||
return img;
|
return img;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn getBackBuffer(self: *Self) *Image {
|
pub fn getBackBuffer(self: *Self) *Image {
|
||||||
var img = &self.images[self.image_index];
|
var img = &self.images[self.getSwapIndex()];
|
||||||
assert(img.handle != .null_handle);
|
assert(img.handle != .null_handle);
|
||||||
return img;
|
return img;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue