Add enable exclusive fullscreen mode setting

This commit is contained in:
MSuih 2022-11-12 13:00:45 +02:00 committed by Megamouse
parent 324b1039cf
commit 3f8421fc17
9 changed files with 67 additions and 20 deletions

View file

@ -555,7 +555,7 @@ namespace vk
std::pair<VkSurfaceCapabilitiesKHR, bool> init_surface_capabilities()
{
#ifdef _WIN32
if (g_cfg.video.vk.force_disable_exclusive_fullscreen_mode && dev.get_surface_capabilities_2_support())
if (g_cfg.video.vk.exclusive_fullscreen_mode != vk_exclusive_fs_mode::unspecified && dev.get_surface_capabilities_2_support())
{
HMONITOR hmonitor = MonitorFromWindow(window_handle, MONITOR_DEFAULTTOPRIMARY);
if (hmonitor)
@ -609,7 +609,7 @@ namespace vk
VkSwapchainKHR old_swapchain = m_vk_swapchain;
vk::physical_device& gpu = const_cast<vk::physical_device&>(dev.gpu());
auto [surface_descriptors, should_disable_exclusive_full_screen] = init_surface_capabilities();
auto [surface_descriptors, should_specify_exclusive_full_screen_mode] = init_surface_capabilities();
if (surface_descriptors.maxImageExtent.width < m_width ||
surface_descriptors.maxImageExtent.height < m_height)
@ -710,10 +710,14 @@ namespace vk
#ifdef _WIN32
VkSurfaceFullScreenExclusiveInfoEXT full_screen_exclusive_info = {};
if (should_disable_exclusive_full_screen)
if (should_specify_exclusive_full_screen_mode)
{
full_screen_exclusive_info.sType = VK_STRUCTURE_TYPE_SURFACE_FULL_SCREEN_EXCLUSIVE_INFO_EXT;
full_screen_exclusive_info.fullScreenExclusive = VK_FULL_SCREEN_EXCLUSIVE_DISALLOWED_EXT;
vk_exclusive_fs_mode fs_mode = g_cfg.video.vk.exclusive_fullscreen_mode;
ensure(fs_mode == vk_exclusive_fs_mode::enable || fs_mode == vk_exclusive_fs_mode::disable);
full_screen_exclusive_info.sType = VK_STRUCTURE_TYPE_SURFACE_FULL_SCREEN_EXCLUSIVE_INFO_EXT;
full_screen_exclusive_info.fullScreenExclusive =
fs_mode == vk_exclusive_fs_mode::enable ? VK_FULL_SCREEN_EXCLUSIVE_ALLOWED_EXT : VK_FULL_SCREEN_EXCLUSIVE_DISALLOWED_EXT;
swap_info.pNext = &full_screen_exclusive_info;
}

View file

@ -185,7 +185,7 @@ struct cfg_root : cfg::node
cfg::string adapter{ this, "Adapter" };
cfg::_bool force_fifo{ this, "Force FIFO present mode" };
cfg::_bool force_primitive_restart{ this, "Force primitive restart flag" };
cfg::_bool force_disable_exclusive_fullscreen_mode{ this, "Force Disable Exclusive Fullscreen Mode", false };
cfg::_enum<vk_exclusive_fs_mode> exclusive_fullscreen_mode{ this, "Exclusive Fullscreen Mode", vk_exclusive_fs_mode::unspecified};
cfg::_bool asynchronous_texture_streaming{ this, "Asynchronous Texture Streaming 2", false };
cfg::_bool fsr_upscaling{ this, "Enable FidelityFX Super Resolution Upscaling", false, true };
cfg::uint<0, 100> rcas_sharpening_intensity{ this, "FidelityFX CAS Sharpening Intensity", 50, true };

View file

@ -612,3 +612,19 @@ void fmt_class_string<gpu_preset_level>::format(std::string& out, u64 arg)
return unknown;
});
}
template <>
void fmt_class_string<vk_exclusive_fs_mode>::format(std::string& out, u64 arg)
{
format_enum(out, arg, [](vk_exclusive_fs_mode value)
{
switch (value)
{
case vk_exclusive_fs_mode::unspecified: return "Automatic";
case vk_exclusive_fs_mode::disable: return "Disable";
case vk_exclusive_fs_mode::enable: return "Enable";
}
return unknown;
});
}

View file

@ -260,6 +260,13 @@ enum class shader_mode
interpreter_only
};
enum class vk_exclusive_fs_mode
{
unspecified,
disable,
enable
};
enum class vk_gpu_scheduler_mode
{
safe,

View file

@ -1270,6 +1270,15 @@ QString emu_settings::GetLocalizedSetting(const QString& original, emu_settings_
case CELL_KB_MAPPING_PORTUGUESE_BRAZIL: return tr("Portuguese keyboard (Brazil)", "Keyboard Type");
case CELL_KB_MAPPING_TURKISH_TURKEY: return tr("Turkish keyboard", "Keyboard Type");
}
break;
case emu_settings_type::ExclusiveFullscreenMode:
switch (static_cast<vk_exclusive_fs_mode>(index))
{
case vk_exclusive_fs_mode::unspecified: return tr("Automatic (Default)", "Exclusive Fullscreen Mode");
case vk_exclusive_fs_mode::disable: return tr("Prefer borderless fullscreen", "Exclusive Fullscreen Mode");
case vk_exclusive_fs_mode::enable: return tr("Prefer exclusive fullscreen", "Exclusive Fullscreen Mode");
}
break;
default:
break;
}

View file

@ -84,7 +84,7 @@ enum class emu_settings_type
MinimumScalableDimension,
FsrUpscalingEnable,
FsrSharpeningStrength,
ForceDisableExclusiveFullscreenMode,
ExclusiveFullscreenMode,
ForceCPUBlitEmulation,
DisableOnDiskShaderCache,
DisableVulkanMemAllocator,
@ -276,7 +276,7 @@ inline static const QMap<emu_settings_type, cfg_location> settings_location =
{ emu_settings_type::VulkanAsyncSchedulerDriver, { "Video", "Vulkan", "Asynchronous Queue Scheduler"}},
{ emu_settings_type::FsrUpscalingEnable, { "Video", "Vulkan", "Enable FidelityFX Super Resolution Upscaling"}},
{ emu_settings_type::FsrSharpeningStrength, { "Video", "Vulkan", "FidelityFX CAS Sharpening Intensity"}},
{ emu_settings_type::ForceDisableExclusiveFullscreenMode, { "Video", "Vulkan", "Force Disable Exclusive Fullscreen Mode"}},
{ emu_settings_type::ExclusiveFullscreenMode, { "Video", "Vulkan", "Exclusive Fullscreen Mode"}},
// Performance Overlay
{ emu_settings_type::PerfOverlayEnabled, { "Video", "Performance Overlay", "Enabled" } },

View file

@ -1354,9 +1354,6 @@ settings_dialog::settings_dialog(std::shared_ptr<gui_settings> gui_settings, std
m_emu_settings->EnhanceCheckBox(ui->disableOnDiskShaderCache, emu_settings_type::DisableOnDiskShaderCache);
SubscribeTooltip(ui->disableOnDiskShaderCache, tooltips.settings.disable_on_disk_shader_cache);
m_emu_settings->EnhanceCheckBox(ui->forceDisableExclusiveFullscreenMode, emu_settings_type::ForceDisableExclusiveFullscreenMode);
SubscribeTooltip(ui->forceDisableExclusiveFullscreenMode, tooltips.settings.force_disable_exclusive_fullscreen_mode);
m_emu_settings->EnhanceCheckBox(ui->vblankNTSCFixup, emu_settings_type::VBlankNTSCFixup);
ui->mfcDelayCommand->setChecked(m_emu_settings->GetSetting(emu_settings_type::MFCCommandsShuffling) == "1");
@ -1380,6 +1377,9 @@ settings_dialog::settings_dialog(std::shared_ptr<gui_settings> gui_settings, std
ui->maxSPURSThreads->setItemText(ui->maxSPURSThreads->findData(6), tr("Unlimited (Default)", "Max SPURS threads"));
SubscribeTooltip(ui->gb_max_spurs_threads, tooltips.settings.max_spurs_threads);
m_emu_settings->EnhanceComboBox(ui->exclusiveFullscreenMode, emu_settings_type::ExclusiveFullscreenMode);
SubscribeTooltip(ui->gb_exclusiveFullscreen, tooltips.settings.exclusive_fullscreen_mode);
m_emu_settings->EnhanceComboBox(ui->sleepTimersAccuracy, emu_settings_type::SleepTimersAccuracy);
SubscribeTooltip(ui->gb_sleep_timers_accuracy, tooltips.settings.sleep_timers_accuracy);

View file

@ -2549,13 +2549,6 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="forceDisableExclusiveFullscreenMode">
<property name="text">
<string>Force Disable Exclusive Fullscreen Mode</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="disableOnDiskShaderCache">
<property name="text">
@ -2616,6 +2609,24 @@
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="gb_exclusiveFullscreen">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>Exclusive Fullscreen Mode</string>
</property>
<layout class="QVBoxLayout" name="gb_exclusiveFullscreen_layout">
<item>
<widget class="QComboBox" name="exclusiveFullscreenMode"/>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="gb_wakeupDelay">
<property name="sizePolicy">

View file

@ -179,8 +179,8 @@ public:
const QString shader_compiler_threads = tr("Number of threads to use for the shader compiler backend.\nOnly has an impact when shader mode is set to one of the asynchronous modes.");
const QString shader_precision = tr("Controls the precision level of generated shaders. Low precision generates much faster code depending on the hardware, but can sometimes generate minor visual glitches or flicker.");
const QString async_texture_streaming = tr("Stream textures to GPU in parallel with 3D rendering using asynchronous compute.\nCan improve performance on more powerful GPUs that have spare headroom.\nOnly works with Vulkan renderer and greatly benefits from having MTRSX enabled if you have a capable CPU.");
const QString force_disable_exclusive_fullscreen_mode = tr("Forces borderless windowed mode for all fullscreen windows. Disables exclusive fullscreen graphics driver optimizations.\nUse when you wish to stream using Vulkan or if your screen goes dim using HDR.\nNote: RPCS3 does not use HDR at all.");
const QString async_texture_streaming = tr("Stream textures to GPU in parallel with 3D rendering using asynchronous compute.\nCan improve performance on more powerful GPUs that have spare headroom.\nOnly works with Vulkan renderer and greatly benefits from having MTRSX enabled if you have a capable CPU.");
const QString exclusive_fullscreen_mode = tr("Controls which fullscreen mode RPCS3 requests from drivers when using Vulkan renderer.\nAutomatic will let the driver choose an appropriate mode, while the other options will hint the drivers on whether they should use exclusive or borderless fullscreen.\nUsing Prefer borderless fullscreen option can help if you have issues with streaming RPCS3 gameplay or if your system incorrectly enables HDR mode when using fullscreen.");
const QString fsr_upscaling = tr("Enable FidelityFX Super Resolution upscaling filter to improve the look of upscaled images.\nIf the game is rendering at an internal resolution lower than your window resolution, FidelityFX will handle the upscale.\nCan cause visual artifacts.\nDoes not work with stereo 3D output for now.");
const QString fsr_rcas_strength = tr("Control the sharpening strength applied by FidelityFX Super Resolution. Higher values will give sharper output but may introduce artifacts.");