Merge branch 'master' into hotkey_enable_version_1

This commit is contained in:
OpenSauce 2025-11-30 18:59:28 +00:00 committed by GitHub
commit 874c223f2f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
19 changed files with 71 additions and 79 deletions

View File

@ -130,25 +130,10 @@ if (BUNDLE_TARGET_EXECUTE)
--icon-file "${CMAKE_BINARY_DIR}/dist/org.azahar_emu.Azahar.svg" --icon-file "${CMAKE_BINARY_DIR}/dist/org.azahar_emu.Azahar.svg"
--desktop-file "${source_path}/dist/${executable_name}.desktop" --desktop-file "${source_path}/dist/${executable_name}.desktop"
--appdir "${appdir_path}" --appdir "${appdir_path}"
RESULT_VARIABLE linuxdeploy_appdir_result) RESULT_VARIABLE linuxdeploy_appdir_result
ERROR_VARIABLE linuxdeploy_appdir_error)
if (NOT linuxdeploy_appdir_result EQUAL "0") if (NOT linuxdeploy_appdir_result EQUAL "0")
message(FATAL_ERROR "linuxdeploy failed to create AppDir: ${linuxdeploy_appdir_result}") message(FATAL_ERROR "linuxdeploy failed to create AppDir w/ exit code ${linuxdeploy_appdir_result}:\n${linuxdeploy_appdir_error}")
endif()
if (enable_qt)
set(qt_hook_file "${appdir_path}/apprun-hooks/linuxdeploy-plugin-qt-hook.sh")
file(READ "${qt_hook_file}" qt_hook_contents)
# Add Cinnamon to list of DEs for GTK3 theming.
string(REPLACE
"*XFCE*"
"*X-Cinnamon*|*XFCE*"
qt_hook_contents "${qt_hook_contents}")
# Wayland backend crashes due to changed schemas in Gnome 40.
string(REPLACE
"export QT_QPA_PLATFORMTHEME=gtk3"
"export QT_QPA_PLATFORMTHEME=gtk3; export GDK_BACKEND=x11"
qt_hook_contents "${qt_hook_contents}")
file(WRITE "${qt_hook_file}" "${qt_hook_contents}")
endif() endif()
message(STATUS "Creating AppImage for executable ${executable_path}") message(STATUS "Creating AppImage for executable ${executable_path}")

View File

@ -44,7 +44,7 @@ enum class BooleanSetting(
CPU_JIT("use_cpu_jit", Settings.SECTION_CORE, true), CPU_JIT("use_cpu_jit", Settings.SECTION_CORE, true),
HW_SHADER("use_hw_shader", Settings.SECTION_RENDERER, true), HW_SHADER("use_hw_shader", Settings.SECTION_RENDERER, true),
SHADER_JIT("use_shader_jit", Settings.SECTION_RENDERER, true), SHADER_JIT("use_shader_jit", Settings.SECTION_RENDERER, true),
VSYNC("use_vsync_new", Settings.SECTION_RENDERER, true), VSYNC("use_vsync", Settings.SECTION_RENDERER, false),
USE_FRAME_LIMIT("use_frame_limit", Settings.SECTION_RENDERER, true), USE_FRAME_LIMIT("use_frame_limit", Settings.SECTION_RENDERER, true),
DEBUG_RENDERER("renderer_debug", Settings.SECTION_DEBUG, false), DEBUG_RENDERER("renderer_debug", Settings.SECTION_DEBUG, false),
DISABLE_RIGHT_EYE_RENDER("disable_right_eye_render", Settings.SECTION_RENDERER, false), DISABLE_RIGHT_EYE_RENDER("disable_right_eye_render", Settings.SECTION_RENDERER, false),

View File

@ -147,7 +147,7 @@ void Config::ReadValues() {
ReadSetting("Renderer", Settings::values.use_shader_jit); ReadSetting("Renderer", Settings::values.use_shader_jit);
ReadSetting("Renderer", Settings::values.resolution_factor); ReadSetting("Renderer", Settings::values.resolution_factor);
ReadSetting("Renderer", Settings::values.use_disk_shader_cache); ReadSetting("Renderer", Settings::values.use_disk_shader_cache);
ReadSetting("Renderer", Settings::values.use_vsync_new); ReadSetting("Renderer", Settings::values.use_vsync);
ReadSetting("Renderer", Settings::values.texture_filter); ReadSetting("Renderer", Settings::values.texture_filter);
ReadSetting("Renderer", Settings::values.texture_sampling); ReadSetting("Renderer", Settings::values.texture_sampling);
ReadSetting("Renderer", Settings::values.turbo_limit); ReadSetting("Renderer", Settings::values.turbo_limit);

View File

@ -134,10 +134,10 @@ use_shader_jit =
# 0 (default): Game Controlled, 1: Nearest Neighbor, 2: Linear # 0 (default): Game Controlled, 1: Nearest Neighbor, 2: Linear
texture_sampling = texture_sampling =
# Forces VSync on the display thread. Usually doesn't impact performance, but on some drivers it can # Forces VSync on the display thread. Can cause input delay, so only turn this on
# so only turn this off if you notice a speed difference. # if you have screen tearing, which is unusual on Android
# 0: Off, 1 (default): On # 0 (default): Off, 1: On
use_vsync_new = use_vsync =
# Reduce stuttering by storing and loading generated shaders to disk # Reduce stuttering by storing and loading generated shaders to disk
# 0: Off, 1 (default. On) # 0: Off, 1 (default. On)
@ -148,10 +148,6 @@ use_disk_shader_cache =
# factor for the 3DS resolution # factor for the 3DS resolution
resolution_factor = resolution_factor =
# Whether to enable V-Sync (caps the framerate at 60FPS) or not.
# 0 (default): Off, 1: On
vsync_enabled =
# Turns on the frame limiter, which will limit frames output to the target game speed # Turns on the frame limiter, which will limit frames output to the target game speed
# 0: Off, 1: On (default) # 0: Off, 1: On (default)
use_frame_limit = use_frame_limit =

View File

@ -122,7 +122,7 @@ EmuWindow_Android_OpenGL::EmuWindow_Android_OpenGL(Core::System& system_, ANativ
LOG_CRITICAL(Frontend, "gladLoadGLES2Loader() failed"); LOG_CRITICAL(Frontend, "gladLoadGLES2Loader() failed");
return; return;
} }
if (!eglSwapInterval(egl_display, Settings::values.use_vsync_new ? 1 : 0)) { if (!eglSwapInterval(egl_display, Settings::values.use_vsync ? 1 : 0)) {
LOG_CRITICAL(Frontend, "eglSwapInterval() failed"); LOG_CRITICAL(Frontend, "eglSwapInterval() failed");
return; return;
} }
@ -218,7 +218,7 @@ void EmuWindow_Android_OpenGL::TryPresenting() {
} }
eglMakeCurrent(egl_display, egl_surface, egl_surface, egl_context); eglMakeCurrent(egl_display, egl_surface, egl_surface, egl_context);
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0); glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
eglSwapInterval(egl_display, Settings::values.use_vsync_new ? 1 : 0); eglSwapInterval(egl_display, Settings::values.use_vsync ? 1 : 0);
system.GPU().Renderer().TryPresent(0, is_secondary); system.GPU().Renderer().TryPresent(0, is_secondary);
eglSwapBuffers(egl_display, egl_surface); eglSwapBuffers(egl_display, egl_surface);
} }

View File

@ -322,7 +322,7 @@
<string name="hw_shaders_description">Uses hardware to emulate 3DS shaders. When enabled, game performance will be significantly improved.</string> <string name="hw_shaders_description">Uses hardware to emulate 3DS shaders. When enabled, game performance will be significantly improved.</string>
<string name="cpu_clock_speed">CPU Clock Speed</string> <string name="cpu_clock_speed">CPU Clock Speed</string>
<string name="vsync">Enable V-Sync</string> <string name="vsync">Enable V-Sync</string>
<string name="vsync_description">Synchronizes the game frame rate to the refresh rate of your device.</string> <string name="vsync_description">Synchronizes the game frame rate to the refresh rate of your device. Can cause additional input latency but may reduce tearing in some cases.</string>
<string name="renderer_debug">Debug Renderer</string> <string name="renderer_debug">Debug Renderer</string>
<string name="renderer_debug_description">Log additional graphics related debug information. When enabled, game performance will be significantly reduced.</string> <string name="renderer_debug_description">Log additional graphics related debug information. When enabled, game performance will be significantly reduced.</string>
<string name="instant_debug_log">Flush Log Output on Every Message</string> <string name="instant_debug_log">Flush Log Output on Every Message</string>

View File

@ -754,7 +754,7 @@ bool GRenderWindow::InitializeOpenGL() {
child->SetContext(std::move(child_context)); child->SetContext(std::move(child_context));
auto format = child_widget->windowHandle()->format(); auto format = child_widget->windowHandle()->format();
format.setSwapInterval(Settings::values.use_vsync_new.GetValue()); format.setSwapInterval(Settings::values.use_vsync.GetValue());
child_widget->windowHandle()->setFormat(format); child_widget->windowHandle()->setFormat(format);
return true; return true;

View File

@ -685,7 +685,7 @@ void QtConfig::ReadRendererValues() {
ReadGlobalSetting(Settings::values.use_hw_shader); ReadGlobalSetting(Settings::values.use_hw_shader);
ReadGlobalSetting(Settings::values.shaders_accurate_mul); ReadGlobalSetting(Settings::values.shaders_accurate_mul);
ReadGlobalSetting(Settings::values.use_disk_shader_cache); ReadGlobalSetting(Settings::values.use_disk_shader_cache);
ReadGlobalSetting(Settings::values.use_vsync_new); ReadGlobalSetting(Settings::values.use_vsync);
ReadGlobalSetting(Settings::values.resolution_factor); ReadGlobalSetting(Settings::values.resolution_factor);
ReadGlobalSetting(Settings::values.frame_limit); ReadGlobalSetting(Settings::values.frame_limit);
ReadGlobalSetting(Settings::values.turbo_limit); ReadGlobalSetting(Settings::values.turbo_limit);
@ -1216,7 +1216,7 @@ void QtConfig::SaveRendererValues() {
WriteGlobalSetting(Settings::values.use_hw_shader); WriteGlobalSetting(Settings::values.use_hw_shader);
WriteGlobalSetting(Settings::values.shaders_accurate_mul); WriteGlobalSetting(Settings::values.shaders_accurate_mul);
WriteGlobalSetting(Settings::values.use_disk_shader_cache); WriteGlobalSetting(Settings::values.use_disk_shader_cache);
WriteGlobalSetting(Settings::values.use_vsync_new); WriteGlobalSetting(Settings::values.use_vsync);
WriteGlobalSetting(Settings::values.resolution_factor); WriteGlobalSetting(Settings::values.resolution_factor);
WriteGlobalSetting(Settings::values.frame_limit); WriteGlobalSetting(Settings::values.frame_limit);
WriteGlobalSetting(Settings::values.turbo_limit); WriteGlobalSetting(Settings::values.turbo_limit);

View File

@ -142,7 +142,7 @@ void ConfigureGraphics::SetConfiguration() {
ui->toggle_hw_shader->setChecked(Settings::values.use_hw_shader.GetValue()); ui->toggle_hw_shader->setChecked(Settings::values.use_hw_shader.GetValue());
ui->toggle_accurate_mul->setChecked(Settings::values.shaders_accurate_mul.GetValue()); ui->toggle_accurate_mul->setChecked(Settings::values.shaders_accurate_mul.GetValue());
ui->toggle_disk_shader_cache->setChecked(Settings::values.use_disk_shader_cache.GetValue()); ui->toggle_disk_shader_cache->setChecked(Settings::values.use_disk_shader_cache.GetValue());
ui->toggle_vsync_new->setChecked(Settings::values.use_vsync_new.GetValue()); ui->toggle_vsync->setChecked(Settings::values.use_vsync.GetValue());
ui->spirv_shader_gen->setChecked(Settings::values.spirv_shader_gen.GetValue()); ui->spirv_shader_gen->setChecked(Settings::values.spirv_shader_gen.GetValue());
ui->disable_spirv_optimizer->setChecked(Settings::values.disable_spirv_optimizer.GetValue()); ui->disable_spirv_optimizer->setChecked(Settings::values.disable_spirv_optimizer.GetValue());
ui->toggle_async_shaders->setChecked(Settings::values.async_shader_compilation.GetValue()); ui->toggle_async_shaders->setChecked(Settings::values.async_shader_compilation.GetValue());
@ -174,8 +174,8 @@ void ConfigureGraphics::ApplyConfiguration() {
ui->texture_sampling_combobox); ui->texture_sampling_combobox);
ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_disk_shader_cache, ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_disk_shader_cache,
ui->toggle_disk_shader_cache, use_disk_shader_cache); ui->toggle_disk_shader_cache, use_disk_shader_cache);
ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_vsync_new, ui->toggle_vsync_new, ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_vsync, ui->toggle_vsync,
use_vsync_new); use_vsync);
ConfigurationShared::ApplyPerGameSetting( ConfigurationShared::ApplyPerGameSetting(
&Settings::values.delay_game_render_thread_us, ui->delay_render_combo, &Settings::values.delay_game_render_thread_us, ui->delay_render_combo,
[this](s32) { return ui->delay_render_slider->value(); }); [this](s32) { return ui->delay_render_slider->value(); });
@ -197,8 +197,8 @@ void ConfigureGraphics::SetupPerGameUI() {
ui->toggle_accurate_mul->setEnabled(Settings::values.shaders_accurate_mul.UsingGlobal()); ui->toggle_accurate_mul->setEnabled(Settings::values.shaders_accurate_mul.UsingGlobal());
ui->toggle_disk_shader_cache->setEnabled( ui->toggle_disk_shader_cache->setEnabled(
Settings::values.use_disk_shader_cache.UsingGlobal()); Settings::values.use_disk_shader_cache.UsingGlobal());
ui->toggle_vsync_new->setEnabled(ui->toggle_vsync_new->isEnabled() && ui->toggle_vsync->setEnabled(ui->toggle_vsync->isEnabled() &&
Settings::values.use_vsync_new.UsingGlobal()); Settings::values.use_vsync.UsingGlobal());
ui->toggle_async_shaders->setEnabled( ui->toggle_async_shaders->setEnabled(
Settings::values.async_shader_compilation.UsingGlobal()); Settings::values.async_shader_compilation.UsingGlobal());
ui->widget_texture_sampling->setEnabled(Settings::values.texture_sampling.UsingGlobal()); ui->widget_texture_sampling->setEnabled(Settings::values.texture_sampling.UsingGlobal());
@ -236,8 +236,8 @@ void ConfigureGraphics::SetupPerGameUI() {
ConfigurationShared::SetColoredTristate(ui->toggle_disk_shader_cache, ConfigurationShared::SetColoredTristate(ui->toggle_disk_shader_cache,
Settings::values.use_disk_shader_cache, Settings::values.use_disk_shader_cache,
use_disk_shader_cache); use_disk_shader_cache);
ConfigurationShared::SetColoredTristate(ui->toggle_vsync_new, Settings::values.use_vsync_new, ConfigurationShared::SetColoredTristate(ui->toggle_vsync, Settings::values.use_vsync,
use_vsync_new); use_vsync);
ConfigurationShared::SetColoredTristate(ui->toggle_async_shaders, ConfigurationShared::SetColoredTristate(ui->toggle_async_shaders,
Settings::values.async_shader_compilation, Settings::values.async_shader_compilation,
async_shader_compilation); async_shader_compilation);

View File

@ -38,7 +38,7 @@ private:
ConfigurationShared::CheckState use_hw_shader; ConfigurationShared::CheckState use_hw_shader;
ConfigurationShared::CheckState shaders_accurate_mul; ConfigurationShared::CheckState shaders_accurate_mul;
ConfigurationShared::CheckState use_disk_shader_cache; ConfigurationShared::CheckState use_disk_shader_cache;
ConfigurationShared::CheckState use_vsync_new; ConfigurationShared::CheckState use_vsync;
ConfigurationShared::CheckState async_shader_compilation; ConfigurationShared::CheckState async_shader_compilation;
ConfigurationShared::CheckState async_presentation; ConfigurationShared::CheckState async_presentation;
ConfigurationShared::CheckState spirv_shader_gen; ConfigurationShared::CheckState spirv_shader_gen;

View File

@ -308,7 +308,7 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QCheckBox" name="toggle_vsync_new"> <widget class="QCheckBox" name="toggle_vsync">
<property name="toolTip"> <property name="toolTip">
<string>VSync prevents the screen from tearing, but some graphics cards have lower performance with VSync enabled. Keep it enabled if you don't notice a performance difference.</string> <string>VSync prevents the screen from tearing, but some graphics cards have lower performance with VSync enabled. Keep it enabled if you don't notice a performance difference.</string>
</property> </property>
@ -416,7 +416,7 @@
<tabstop>toggle_accurate_mul</tabstop> <tabstop>toggle_accurate_mul</tabstop>
<tabstop>toggle_shader_jit</tabstop> <tabstop>toggle_shader_jit</tabstop>
<tabstop>toggle_disk_shader_cache</tabstop> <tabstop>toggle_disk_shader_cache</tabstop>
<tabstop>toggle_vsync_new</tabstop> <tabstop>toggle_vsync</tabstop>
</tabstops> </tabstops>
<resources/> <resources/>
<connections/> <connections/>

View File

@ -145,7 +145,7 @@ void SdlConfig::ReadValues() {
ReadSetting("Renderer", Settings::values.resolution_factor); ReadSetting("Renderer", Settings::values.resolution_factor);
ReadSetting("Renderer", Settings::values.use_disk_shader_cache); ReadSetting("Renderer", Settings::values.use_disk_shader_cache);
ReadSetting("Renderer", Settings::values.frame_limit); ReadSetting("Renderer", Settings::values.frame_limit);
ReadSetting("Renderer", Settings::values.use_vsync_new); ReadSetting("Renderer", Settings::values.use_vsync);
ReadSetting("Renderer", Settings::values.texture_filter); ReadSetting("Renderer", Settings::values.texture_filter);
ReadSetting("Renderer", Settings::values.texture_sampling); ReadSetting("Renderer", Settings::values.texture_sampling);
ReadSetting("Renderer", Settings::values.delay_game_render_thread_us); ReadSetting("Renderer", Settings::values.delay_game_render_thread_us);

View File

@ -121,7 +121,7 @@ use_shader_jit =
# Forces VSync on the display thread. Usually doesn't impact performance, but on some drivers it can # Forces VSync on the display thread. Usually doesn't impact performance, but on some drivers it can
# so only turn this off if you notice a speed difference. # so only turn this off if you notice a speed difference.
# 0: Off, 1 (default): On # 0: Off, 1 (default): On
use_vsync_new = use_vsync =
# Reduce stuttering by storing and loading generated shaders to disk # Reduce stuttering by storing and loading generated shaders to disk
# 0: Off, 1 (default. On) # 0: Off, 1 (default. On)

View File

@ -98,7 +98,7 @@ void LogSettings() {
log_setting("Renderer_UseShaderJit", values.use_shader_jit.GetValue()); log_setting("Renderer_UseShaderJit", values.use_shader_jit.GetValue());
log_setting("Renderer_UseResolutionFactor", values.resolution_factor.GetValue()); log_setting("Renderer_UseResolutionFactor", values.resolution_factor.GetValue());
log_setting("Renderer_FrameLimit", values.frame_limit.GetValue()); log_setting("Renderer_FrameLimit", values.frame_limit.GetValue());
log_setting("Renderer_VSyncNew", values.use_vsync_new.GetValue()); log_setting("Renderer_VSyncNew", values.use_vsync.GetValue());
log_setting("Renderer_PostProcessingShader", values.pp_shader_name.GetValue()); log_setting("Renderer_PostProcessingShader", values.pp_shader_name.GetValue());
log_setting("Renderer_FilterMode", values.filter_mode.GetValue()); log_setting("Renderer_FilterMode", values.filter_mode.GetValue());
log_setting("Renderer_TextureFilter", GetTextureFilterName(values.texture_filter.GetValue())); log_setting("Renderer_TextureFilter", GetTextureFilterName(values.texture_filter.GetValue()));
@ -200,7 +200,7 @@ void RestoreGlobalState(bool is_powered_on) {
values.use_hw_shader.SetGlobal(true); values.use_hw_shader.SetGlobal(true);
values.use_disk_shader_cache.SetGlobal(true); values.use_disk_shader_cache.SetGlobal(true);
values.shaders_accurate_mul.SetGlobal(true); values.shaders_accurate_mul.SetGlobal(true);
values.use_vsync_new.SetGlobal(true); values.use_vsync.SetGlobal(true);
values.resolution_factor.SetGlobal(true); values.resolution_factor.SetGlobal(true);
values.frame_limit.SetGlobal(true); values.frame_limit.SetGlobal(true);
values.texture_filter.SetGlobal(true); values.texture_filter.SetGlobal(true);

View File

@ -506,7 +506,7 @@ struct Values {
SwitchableSetting<bool> use_hw_shader{true, "use_hw_shader"}; SwitchableSetting<bool> use_hw_shader{true, "use_hw_shader"};
SwitchableSetting<bool> use_disk_shader_cache{true, "use_disk_shader_cache"}; SwitchableSetting<bool> use_disk_shader_cache{true, "use_disk_shader_cache"};
SwitchableSetting<bool> shaders_accurate_mul{true, "shaders_accurate_mul"}; SwitchableSetting<bool> shaders_accurate_mul{true, "shaders_accurate_mul"};
SwitchableSetting<bool> use_vsync_new{true, "use_vsync_new"}; SwitchableSetting<bool> use_vsync{true, "use_vsync"};
Setting<bool> use_shader_jit{true, "use_shader_jit"}; Setting<bool> use_shader_jit{true, "use_shader_jit"};
SwitchableSetting<u32, true> resolution_factor{1, 0, 10, "resolution_factor"}; SwitchableSetting<u32, true> resolution_factor{1, 0, 10, "resolution_factor"};
SwitchableSetting<double, true> frame_limit{100, 0, 1000, "frame_limit"}; SwitchableSetting<double, true> frame_limit{100, 0, 1000, "frame_limit"};

View File

@ -61,31 +61,6 @@ constexpr static std::array<vk::DescriptorSetLayoutBinding, 1> PRESENT_BINDINGS
namespace { namespace {
static bool IsLowRefreshRate() { static bool IsLowRefreshRate() {
#if defined(__APPLE__) || defined(ENABLE_SDL2) #if defined(__APPLE__) || defined(ENABLE_SDL2)
#ifdef __APPLE__ // Need a special implementation because MacOS kills itself in disgust if the
// input thread calls SDL_PumpEvents at the same time as we're in SDL_Init here.
const auto cur_refresh_rate = AppleUtils::GetRefreshRate();
#elif defined(ENABLE_SDL2)
if (SDL_Init(SDL_INIT_VIDEO) != 0) {
LOG_ERROR(Render_Vulkan, "SDL video failed to initialize, unable to check refresh rate");
return false;
}
SDL_DisplayMode cur_display_mode;
SDL_GetCurrentDisplayMode(0, &cur_display_mode); // TODO: Multimonitor handling. -OS
const auto cur_refresh_rate = cur_display_mode.refresh_rate;
SDL_QuitSubSystem(SDL_INIT_VIDEO);
#endif // __APPLE__
if (cur_refresh_rate < SCREEN_REFRESH_RATE) {
LOG_WARNING(Render_Vulkan,
"Detected refresh rate lower than the emulated 3DS screen: {}hz. FIFO will "
"be disabled",
cur_refresh_rate);
return true;
}
#endif // defined(__APPLE__) || defined(ENABLE_SDL2)
#ifdef __APPLE__ #ifdef __APPLE__
// Apple's low power mode sometimes limits applications to 30fps without changing the refresh // Apple's low power mode sometimes limits applications to 30fps without changing the refresh
// rate, meaning the above code doesn't catch it. // rate, meaning the above code doesn't catch it.
@ -94,8 +69,34 @@ static bool IsLowRefreshRate() {
"framerate. FIFO will be disabled"); "framerate. FIFO will be disabled");
return true; return true;
} }
#endif
const auto cur_refresh_rate = AppleUtils::GetRefreshRate();
#elif defined(ENABLE_SDL2)
if (SDL_WasInit(SDL_INIT_VIDEO) == 0) {
LOG_ERROR(Render_Vulkan, "Attempted to check refresh rate via SDL, but failed because "
"SDL_INIT_VIDEO wasn't initialized");
return false;
}
SDL_DisplayMode cur_display_mode;
SDL_GetCurrentDisplayMode(0, &cur_display_mode); // TODO: Multimonitor handling. -OS
const auto cur_refresh_rate = cur_display_mode.refresh_rate;
#endif // ENABLE_SDL2
if (cur_refresh_rate < SCREEN_REFRESH_RATE) {
LOG_WARNING(Render_Vulkan,
"Detected refresh rate lower than the emulated 3DS screen: {}hz. FIFO will "
"be disabled",
cur_refresh_rate);
return true;
} else {
LOG_INFO(Render_Vulkan, "Refresh rate is above emulated 3DS screen: {}hz. Good.",
cur_refresh_rate);
}
#endif // defined(__APPLE__) || defined(ENABLE_SDL2)
// We have no available method of checking refresh rate. Just assume that everything is fine :)
return false; return false;
} }
} // Anonymous namespace } // Anonymous namespace

View File

@ -105,7 +105,7 @@ PresentWindow::PresentWindow(Frontend::EmuWindow& emu_window_, const Instance& i
swapchain{instance, emu_window.GetFramebufferLayout().width, swapchain{instance, emu_window.GetFramebufferLayout().width,
emu_window.GetFramebufferLayout().height, surface, low_refresh_rate_}, emu_window.GetFramebufferLayout().height, surface, low_refresh_rate_},
graphics_queue{instance.GetGraphicsQueue()}, present_renderpass{CreateRenderpass()}, graphics_queue{instance.GetGraphicsQueue()}, present_renderpass{CreateRenderpass()},
vsync_enabled{Settings::values.use_vsync_new.GetValue()}, vsync_enabled{Settings::values.use_vsync.GetValue()},
blit_supported{ blit_supported{
CanBlitToSwapchain(instance.GetPhysicalDevice(), swapchain.GetSurfaceFormat().format)}, CanBlitToSwapchain(instance.GetPhysicalDevice(), swapchain.GetSurfaceFormat().format)},
use_present_thread{Settings::values.async_presentation.GetValue()}, use_present_thread{Settings::values.async_presentation.GetValue()},
@ -360,7 +360,7 @@ void PresentWindow::CopyToSwapchain(Frame* frame) {
}; };
#ifndef ANDROID #ifndef ANDROID
const bool use_vsync = Settings::values.use_vsync_new.GetValue(); const bool use_vsync = Settings::values.use_vsync.GetValue();
const bool size_changed = const bool size_changed =
swapchain.GetWidth() != frame->width || swapchain.GetHeight() != frame->height; swapchain.GetWidth() != frame->width || swapchain.GetHeight() != frame->height;
const bool vsync_changed = vsync_enabled != use_vsync; const bool vsync_changed = vsync_enabled != use_vsync;

View File

@ -161,7 +161,7 @@ void Swapchain::FindPresentFormat() {
void Swapchain::SetPresentMode() { void Swapchain::SetPresentMode() {
const auto modes = instance.GetPhysicalDevice().getSurfacePresentModesKHR(surface); const auto modes = instance.GetPhysicalDevice().getSurfacePresentModesKHR(surface);
const bool use_vsync = Settings::values.use_vsync_new.GetValue(); const bool use_vsync = Settings::values.use_vsync.GetValue();
const auto find_mode = [&modes](vk::PresentModeKHR requested) { const auto find_mode = [&modes](vk::PresentModeKHR requested) {
const auto it = const auto it =
std::find_if(modes.begin(), modes.end(), std::find_if(modes.begin(), modes.end(),

View File

@ -1,4 +1,4 @@
// Copyright 2014 Citra Emulator Project // Copyright Citra Emulator Project / Azahar Emulator Project
// Licensed under GPLv2 or any later version // Licensed under GPLv2 or any later version
// Refer to the license.txt file included. // Refer to the license.txt file included.
@ -16,6 +16,10 @@
#endif #endif
#include "video_core/video_core.h" #include "video_core/video_core.h"
#ifdef ENABLE_SDL2
#include <SDL.h>
#endif
namespace VideoCore { namespace VideoCore {
std::unique_ptr<RendererBase> CreateRenderer(Frontend::EmuWindow& emu_window, std::unique_ptr<RendererBase> CreateRenderer(Frontend::EmuWindow& emu_window,
@ -29,6 +33,12 @@ std::unique_ptr<RendererBase> CreateRenderer(Frontend::EmuWindow& emu_window,
#endif #endif
#ifdef ENABLE_VULKAN #ifdef ENABLE_VULKAN
case Settings::GraphicsAPI::Vulkan: case Settings::GraphicsAPI::Vulkan:
#if defined(ENABLE_SDL2) && !defined(__APPLE__)
// TODO: When we migrate to SDL3, refactor so that we don't need to init here.
if (SDL_WasInit(SDL_INIT_VIDEO) == 0) {
SDL_Init(SDL_INIT_VIDEO);
}
#endif // ENABLE_SDL2
return std::make_unique<Vulkan::RendererVulkan>(system, pica, emu_window, secondary_window); return std::make_unique<Vulkan::RendererVulkan>(system, pica, emu_window, secondary_window);
#endif #endif
#ifdef ENABLE_OPENGL #ifdef ENABLE_OPENGL