clean up acquire/present
This commit is contained in:
20
src/main.zig
20
src/main.zig
@@ -248,12 +248,7 @@ pub fn main() !void {
|
||||
try au.D.resetFences(1, &.{flight.fence});
|
||||
try au.D.resetCommandPool(flight.pool, .{});
|
||||
|
||||
const acq = try au.D.acquireNextImageKHR(
|
||||
sc.handle,
|
||||
std.math.maxInt(u64),
|
||||
flight.acquire,
|
||||
.null_handle,
|
||||
);
|
||||
const tgt = try sc.acquire(flight.acquire, .null_handle);
|
||||
|
||||
var cmd = au.CommandBufferProxy.init(flight.cmd, au.D.wrapper);
|
||||
try cmd.beginCommandBuffer(&.{ .flags = .{ .one_time_submit_bit = true } });
|
||||
@@ -263,7 +258,7 @@ pub fn main() !void {
|
||||
.extent = sc.cinfo.image_extent,
|
||||
};
|
||||
|
||||
sc.beginRendering(cmd, render_area, acq.image_index);
|
||||
tgt.begin_rendering(cmd, render_area);
|
||||
record_render(
|
||||
cmd,
|
||||
uber,
|
||||
@@ -273,7 +268,7 @@ pub fn main() !void {
|
||||
descriptorSet,
|
||||
);
|
||||
im.c.ImGui_ImplVulkan_RenderDrawData(im.c.igGetDrawData(), @ptrFromInt(@intFromEnum(cmd.handle)), null);
|
||||
sc.endRendering(cmd, acq.image_index);
|
||||
tgt.end_rendering(cmd);
|
||||
|
||||
for (vertex_data) |*v| {
|
||||
for (v.pos[0..2]) |*f| {
|
||||
@@ -304,14 +299,7 @@ pub fn main() !void {
|
||||
@panic("Submission failed");
|
||||
};
|
||||
|
||||
_ = try au.Q.presentKHR(&vk.PresentInfoKHR{
|
||||
.wait_semaphore_count = 1,
|
||||
.p_wait_semaphores = &.{flight.complete},
|
||||
.swapchain_count = 1,
|
||||
.p_swapchains = &.{sc.handle},
|
||||
.p_image_indices = &.{acq.image_index},
|
||||
.p_results = null,
|
||||
}); // todo suboptimal?
|
||||
_ = try sc.present(&.{flight.complete}, tgt); // todo suboptimal?
|
||||
}
|
||||
|
||||
try au.D.deviceWaitIdle();
|
||||
|
Reference in New Issue
Block a user