Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use VK_PRESENT_MODE_IMMEDIATE_KHR when vsync is turned off #530

Open
Tracked by #533
IAmNotHanni opened this issue May 11, 2023 · 1 comment
Open
Tracked by #533

Use VK_PRESENT_MODE_IMMEDIATE_KHR when vsync is turned off #530

IAmNotHanni opened this issue May 11, 2023 · 1 comment
Labels
diff:first issue good first issue to start contributing feat:rendering rendering

Comments

@IAmNotHanni
Copy link
Member

IAmNotHanni commented May 11, 2023

Is your feature request related to a problem?

Currently, this is our default present mode priority list:

static const std::vector<VkPresentModeKHR> default_present_mode_priorities{
    VK_PRESENT_MODE_MAILBOX_KHR,
    VK_PRESENT_MODE_FIFO_RELAXED_KHR,
    VK_PRESENT_MODE_FIFO_KHR
};

Description

When choosing the VkPresentModeKHR in the swapchain wrapper, we do this:

VkPresentModeKHR Swapchain::choose_present_mode(const std::vector<VkPresentModeKHR> &available_present_modes,
                                                const std::vector<VkPresentModeKHR> &present_mode_priority_list,
                                                const bool vsync_enabled) {
    assert(!available_present_modes.empty());
    assert(!present_mode_priority_list.empty());
    if (!vsync_enabled) {
        for (const auto requested_present_mode : present_mode_priority_list) {
            const auto present_mode =
                std::find(available_present_modes.begin(), available_present_modes.end(), requested_present_mode);
            if (present_mode != available_present_modes.end()) {
                return *present_mode;
            }
        }
    }
    return VK_PRESENT_MODE_FIFO_KHR;
}

Even if vsync is turned off, VK_PRESENT_MODE_IMMEDIATE_KHR is not considered because it's not in our default list of present modes.

Alternatives

Enforce vsync by not supporting VK_PRESENT_MODE_IMMEDIATE_KHR (not recommended)

Affected Code

The swapchain wrapper

Operating System

All

Additional Context

none

@IAmNotHanni IAmNotHanni added diff:first issue good first issue to start contributing feat:rendering rendering labels May 11, 2023
@IAmNotHanni
Copy link
Member Author

Another title for this issue could be "allow vsync to be turned off again".

@IAmNotHanni IAmNotHanni mentioned this issue Jun 14, 2023
22 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
diff:first issue good first issue to start contributing feat:rendering rendering
Projects
None yet
Development

No branches or pull requests

1 participant