Skip to content

Commit

Permalink
todo: Handle mailbox_khr in the future
Browse files Browse the repository at this point in the history
It requires the timing to be done by the application as the most recent frame
is always pushed onto it's internal queue.
I need query the monitor refresh rate and ensure we are rendering at that frequency.
  • Loading branch information
siniarskimar committed Aug 16, 2024
1 parent bcf6e84 commit d01f4c1
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/vulkan.zig
Original file line number Diff line number Diff line change
Expand Up @@ -532,17 +532,18 @@ pub const Swapchain = struct {
/// `fifo_khr` maintains a mutiple-entry queue. Each entry is appened to the end of the queue
///
/// [p] - [1] - [2] - ...
// TODO: When using mailbox_khr, manually limit frame rate to display's refresh rate
fn findPresentationMode(
allocator: std.mem.Allocator,
instance: Instance,
context: *const RenderContext,
_: std.mem.Allocator,
_: Instance,
_: *const RenderContext,
) !vk.PresentModeKHR {
const modes = try instance.getPhysicalDeviceSurfacePresentModesAllocKHR(context.pdev, context.surface, allocator);
defer allocator.free(modes);
// const modes = try instance.getPhysicalDeviceSurfacePresentModesAllocKHR(context.pdev, context.surface, allocator);
// defer allocator.free(modes);

for (modes) |mode| {
if (mode == .mailbox_khr) return mode;
}
// for (modes) |mode| {
// if (mode == .mailbox_khr) return mode;
// }

return .fifo_khr;
}
Expand Down

0 comments on commit d01f4c1

Please sign in to comment.