metal: Remove wait

This commit is contained in:
foxnne 2024-12-06 15:48:29 -06:00 committed by Emi Gutekanst
parent 059a271b3b
commit 5ba95f714d

View file

@ -478,16 +478,19 @@ pub const SwapChain = struct {
const pool = objc.autoreleasePoolPush(); const pool = objc.autoreleasePoolPush();
defer objc.autoreleasePoolPop(pool); defer objc.autoreleasePoolPop(pool);
if (swapchain.current_drawable) |_| { if (swapchain.current_drawable) |drawable| {
const queue = try swapchain.device.getQueue(); const queue = try swapchain.device.getQueue();
const command_buffer: *mtl.CommandBuffer = queue.command_queue.commandBuffer() orelse { const command_buffer: *mtl.CommandBuffer = queue.command_queue.commandBuffer() orelse {
return error.NewCommandBufferFailed; return error.NewCommandBufferFailed;
}; };
command_buffer.presentDrawable(@ptrCast(swapchain.current_drawable)); // TODO - objc casting? if (swapchain.surface.layer.displaySyncEnabled()) {
command_buffer.commit(); command_buffer.commit();
if (swapchain.surface.layer.displaySyncEnabled()) drawable.present();
command_buffer.waitUntilCompleted(); } else {
command_buffer.presentDrawable(@ptrCast(drawable));
command_buffer.commit();
}
} }
} }
}; };