Skip to content

Commit

Permalink
metal: Remove wait
Browse files Browse the repository at this point in the history
  • Loading branch information
foxnne authored and emidoots committed Dec 8, 2024
1 parent 059a271 commit 5ba95f7
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/sysgpu/metal.zig
Original file line number Diff line number Diff line change
Expand Up @@ -478,16 +478,19 @@ pub const SwapChain = struct {
const pool = objc.autoreleasePoolPush();
defer objc.autoreleasePoolPop(pool);

if (swapchain.current_drawable) |_| {
if (swapchain.current_drawable) |drawable| {
const queue = try swapchain.device.getQueue();
const command_buffer: *mtl.CommandBuffer = queue.command_queue.commandBuffer() orelse {
return error.NewCommandBufferFailed;
};

command_buffer.presentDrawable(@ptrCast(swapchain.current_drawable)); // TODO - objc casting?
command_buffer.commit();
if (swapchain.surface.layer.displaySyncEnabled())
command_buffer.waitUntilCompleted();
if (swapchain.surface.layer.displaySyncEnabled()) {
command_buffer.commit();
drawable.present();
} else {
command_buffer.presentDrawable(@ptrCast(drawable));
command_buffer.commit();
}
}
}
};
Expand Down

0 comments on commit 5ba95f7

Please sign in to comment.