submit command
This commit is contained in:
@@ -6,7 +6,8 @@ const Self = @This();
|
||||
|
||||
alloc: std.mem.Allocator,
|
||||
cinfo: vk.SwapchainCreateInfoKHR,
|
||||
handle: vk.SwapchainKHR,
|
||||
handle: vk.SwapchainKHR = .null_handle,
|
||||
images: std.ArrayListUnmanaged(vk.Image) = .{},
|
||||
|
||||
pub fn init(alloc: std.mem.Allocator) !Self {
|
||||
const caps = try au.I.getPhysicalDeviceSurfaceCapabilitiesKHR(au.device_config.pdev, au.W.surface);
|
||||
@@ -36,11 +37,11 @@ pub fn init(alloc: std.mem.Allocator) !Self {
|
||||
.clipped = vk.TRUE,
|
||||
.old_swapchain = .null_handle,
|
||||
},
|
||||
.handle = .null_handle,
|
||||
};
|
||||
}
|
||||
|
||||
pub fn deinit(self: *Self) void {
|
||||
self.images.deinit(self.alloc);
|
||||
au.D.destroySwapchainKHR(self.handle, null);
|
||||
}
|
||||
|
||||
@@ -62,7 +63,16 @@ pub fn rebuild(self: *Self) !bool {
|
||||
au.D.destroySwapchainKHR(self.cinfo.old_swapchain, null);
|
||||
self.cinfo.old_swapchain = self.handle;
|
||||
|
||||
var count: u32 = undefined;
|
||||
_ = try au.D.getSwapchainImagesKHR(self.handle, &count, null);
|
||||
try self.images.resize(self.alloc, count);
|
||||
_ = try au.D.getSwapchainImagesKHR(self.handle, &count, self.images.items.ptr);
|
||||
|
||||
// todo repopulate images and synchronization
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
pub fn get(self: Self, idx: u32) vk.Image {
|
||||
return self.images.items[idx];
|
||||
}
|
||||
|
Reference in New Issue
Block a user