mirror of
https://git.citron-emu.org/citron/emulator
synced 2025-12-19 10:43:33 +00:00
fix: is_wayland_platform flag to prioritize low-latency
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
// SPDX-FileCopyrightText: Copyright 2019 yuzu Emulator Project
|
// SPDX-FileCopyrightText: Copyright 2019 yuzu Emulator Project
|
||||||
|
// SPDX-FileCopyrightText: Copyright 2025 citron Emulator Project
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
@@ -37,6 +38,27 @@ VkSurfaceFormatKHR ChooseSwapSurfaceFormat(vk::Span<VkSurfaceFormatKHR> formats)
|
|||||||
|
|
||||||
static VkPresentModeKHR ChooseSwapPresentMode(bool has_imm, bool has_mailbox,
|
static VkPresentModeKHR ChooseSwapPresentMode(bool has_imm, bool has_mailbox,
|
||||||
bool has_fifo_relaxed) {
|
bool has_fifo_relaxed) {
|
||||||
|
// Wayland-specific optimizations for low-latency presentation.
|
||||||
|
if (Settings::values.is_wayland_platform.GetValue()) {
|
||||||
|
LOG_INFO(Render_Vulkan, "Wayland platform detected. Prioritizing low-latency presentation modes.");
|
||||||
|
|
||||||
|
// On Wayland, Mailbox is strongly preferred for smooth, low-latency rendering.
|
||||||
|
if (has_mailbox) {
|
||||||
|
LOG_INFO(Render_Vulkan, "Using Mailbox presentation mode for Wayland.");
|
||||||
|
return VK_PRESENT_MODE_MAILBOX_KHR;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Allow Immediate for lowest latency if the user explicitly chooses it.
|
||||||
|
if (has_imm && Settings::values.vsync_mode.GetValue() == Settings::VSyncMode::Immediate) {
|
||||||
|
LOG_INFO(Render_Vulkan, "Using Immediate presentation mode for Wayland (tearing may occur).");
|
||||||
|
return VK_PRESENT_MODE_IMMEDIATE_KHR;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fallback to standard FIFO (V-Sync) if Mailbox is not available.
|
||||||
|
LOG_INFO(Render_Vulkan, "Mailbox not available. Falling back to FIFO presentation mode for Wayland.");
|
||||||
|
return VK_PRESENT_MODE_FIFO_KHR;
|
||||||
|
}
|
||||||
|
|
||||||
// Mailbox doesn't lock the application like FIFO (vsync)
|
// Mailbox doesn't lock the application like FIFO (vsync)
|
||||||
// FIFO present mode locks the framerate to the monitor's refresh rate
|
// FIFO present mode locks the framerate to the monitor's refresh rate
|
||||||
Settings::VSyncMode setting = [has_imm, has_mailbox]() {
|
Settings::VSyncMode setting = [has_imm, has_mailbox]() {
|
||||||
|
|||||||
Reference in New Issue
Block a user