mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-12-02 02:33:43 +01:00
Merge pull request #21616 from jasaaved/borderless-fullscreen
Windows Vulkan: default to borderless fullscreen, add exclusive option
This commit is contained in:
9 files changed
+57
-2
No files matched your search
@@ -670,7 +670,9 @@ VkResult VulkanContext::CreateDevice(int physical_device) {
|
||||
}
|
||||
|
||||
extensionsLookup_.EXT_provoking_vertex = EnableDeviceExtension(VK_EXT_PROVOKING_VERTEX_EXTENSION_NAME, 0);
|
||||
|
||||
#ifdef VK_EXT_full_screen_exclusive
|
||||
extensionsLookup_.EXT_full_screen_exclusive = EnableDeviceExtension(VK_EXT_FULL_SCREEN_EXCLUSIVE_EXTENSION_NAME, 0);
|
||||
#endif
|
||||
extensionsLookup_.KHR_present_mode_fifo_latest_ready = EnableDeviceExtension(VK_KHR_PRESENT_MODE_FIFO_LATEST_READY_EXTENSION_NAME, 0);
|
||||
if (!extensionsLookup_.KHR_present_mode_fifo_latest_ready) {
|
||||
// Enable the EXT extension instead if available, it's equivalent (was promoted).
|
||||
@@ -1530,6 +1532,19 @@ bool VulkanContext::InitSwapchain(VkPresentModeKHR desiredPresentMode) {
|
||||
swap_chain_info.compositeAlpha = VK_COMPOSITE_ALPHA_INHERIT_BIT_KHR;
|
||||
}
|
||||
|
||||
#ifdef VK_EXT_full_screen_exclusive
|
||||
VkSurfaceFullScreenExclusiveInfoEXT fullScreenInfo{ VK_STRUCTURE_TYPE_SURFACE_FULL_SCREEN_EXCLUSIVE_INFO_EXT };
|
||||
VkSurfaceFullScreenExclusiveWin32InfoEXT win32ExclusiveInfo{ VK_STRUCTURE_TYPE_SURFACE_FULL_SCREEN_EXCLUSIVE_WIN32_INFO_EXT };
|
||||
if (extensionsLookup_.EXT_full_screen_exclusive) {
|
||||
fullScreenInfo.fullScreenExclusive = fullScreenExclusiveMode_;
|
||||
if (fullScreenExclusiveMode_ == VK_FULL_SCREEN_EXCLUSIVE_ALLOWED_EXT) {
|
||||
win32ExclusiveInfo.hmonitor = MonitorFromWindow((HWND)winsysData2_, MONITOR_DEFAULTTONEAREST);
|
||||
fullScreenInfo.pNext = &win32ExclusiveInfo;
|
||||
}
|
||||
swap_chain_info.pNext = &fullScreenInfo;
|
||||
}
|
||||
#endif
|
||||
|
||||
res = vkCreateSwapchainKHR(device_, &swap_chain_info, NULL, &swapchain_);
|
||||
if (res != VK_SUCCESS) {
|
||||
ERROR_LOG(Log::G3D, "vkCreateSwapchainKHR failed! %s", VulkanResultToString(res));
|
||||
|
||||
@@ -412,6 +412,10 @@ public:
|
||||
return presentMode_;
|
||||
}
|
||||
|
||||
#ifdef VK_EXT_full_screen_exclusive
|
||||
void SetFullScreenExclusiveMode(VkFullScreenExclusiveEXT mode) { fullScreenExclusiveMode_ = mode; }
|
||||
#endif
|
||||
|
||||
std::vector<VkPresentModeKHR> GetAvailablePresentModes() const {
|
||||
return availablePresentModes_;
|
||||
}
|
||||
@@ -530,6 +534,11 @@ private:
|
||||
|
||||
PhysicalDeviceFeatures deviceFeatures_;
|
||||
|
||||
#ifdef VK_EXT_full_screen_exclusive
|
||||
VkFullScreenExclusiveEXT fullScreenExclusiveMode_ = VK_FULL_SCREEN_EXCLUSIVE_DEFAULT_EXT;
|
||||
#endif
|
||||
|
||||
|
||||
VkSurfaceCapabilitiesKHR surfCapabilities_{};
|
||||
std::vector<VkSurfaceFormatKHR> surfFormats_{};
|
||||
|
||||
|
||||
@@ -272,6 +272,7 @@ struct VulkanExtensions {
|
||||
bool EXT_provoking_vertex;
|
||||
bool KHR_present_mode_fifo_latest_ready;
|
||||
bool EXT_scalar_block_layout;
|
||||
bool EXT_full_screen_exclusive;
|
||||
// bool EXT_depth_range_unrestricted; // Allows depth outside [0.0, 1.0] in 32-bit float depth buffers.
|
||||
};
|
||||
|
||||
|
||||
@@ -953,6 +953,7 @@ VKContext::VKContext(VulkanContext *vulkan, bool useRenderThread)
|
||||
// Note that it must also be enabled on the pipelines (which we do).
|
||||
caps_.provokingVertexLast = vulkan->GetDeviceFeatures().enabled.provokingVertex.provokingVertexLast;
|
||||
|
||||
caps_.fullScreenExclusiveSupported = vulkan->Extensions().EXT_full_screen_exclusive;
|
||||
// Present mode stuff
|
||||
caps_.presentMaxInterval = 1;
|
||||
caps_.presentInstantModeChange = false; // TODO: Fix this with some work in VulkanContext
|
||||
|
||||
@@ -633,6 +633,7 @@ struct DeviceCaps {
|
||||
bool requiresHalfPixelOffset;
|
||||
bool provokingVertexLast; // GL behavior, what the PSP does
|
||||
bool verySlowShaderCompiler;
|
||||
bool fullScreenExclusiveSupported;
|
||||
|
||||
// Old style, for older GL or Direct3D 9.
|
||||
u32 clipPlanesSupported;
|
||||
|
||||
@@ -748,6 +748,7 @@ static const ConfigSetting graphicsSettings[] = {
|
||||
|
||||
#ifndef MOBILE_DEVICE
|
||||
ConfigSetting("FullScreen", SETTING(g_Config, bFullScreen), false, CfgFlag::DEFAULT),
|
||||
ConfigSetting("FullScreenExclusive", SETTING(g_Config, bAllowFullScreenExclusive), false, CfgFlag::DEFAULT),
|
||||
ConfigSetting("FullScreenMulti", SETTING(g_Config, bFullScreenMulti), false, CfgFlag::DEFAULT),
|
||||
#endif
|
||||
|
||||
|
||||
@@ -325,6 +325,7 @@ public:
|
||||
int iAppSwitchMode;
|
||||
bool bFullScreen;
|
||||
bool bFullScreenMulti;
|
||||
bool bAllowFullScreenExclusive;
|
||||
int iInternalResolution; // 0 = Auto (native), 1 = 1x (480x272), 2 = 2x, 3 = 3x, 4 = 4x and so on.
|
||||
int iAnisotropyLevel; // 0 - 5, powers of 2: 0 = 1x = no aniso
|
||||
int iMultiSampleLevel;
|
||||
|
||||
@@ -412,10 +412,22 @@ void GameSettingsScreen::CreateGraphicsSettings(UI::ViewGroup *graphicsSettings)
|
||||
fullscreenCheckbox->OnClick.Add([](UI::EventParams &e) {
|
||||
System_ApplyFullscreenState();
|
||||
});
|
||||
if (draw->GetDeviceCaps().fullScreenExclusiveSupported) {
|
||||
CheckBox* fullscreenExclusive = graphicsSettings->Add(new CheckBox(&g_Config.bAllowFullScreenExclusive, gr->T("Allow exclusive fullscreen")));
|
||||
fullscreenExclusive->SetEnabledFunc([] {
|
||||
return g_Config.bFullScreen && !g_Config.bFullScreenMulti;
|
||||
});
|
||||
fullscreenExclusive->OnClick.Add([this](UI::EventParams &e) {
|
||||
TriggerRestartOrDo([this]() {
|
||||
g_Config.bAllowFullScreenExclusive = !g_Config.bAllowFullScreenExclusive;
|
||||
RecreateViews();
|
||||
});
|
||||
});
|
||||
}
|
||||
if (System_GetPropertyInt(SYSPROP_DISPLAY_COUNT) > 1) {
|
||||
CheckBox *fullscreenMulti = graphicsSettings->Add(new CheckBox(&g_Config.bFullScreenMulti, gr->T("Use all displays")));
|
||||
fullscreenMulti->SetEnabledFunc([] {
|
||||
return g_Config.bFullScreen;
|
||||
return g_Config.bFullScreen && !g_Config.bAllowFullScreenExclusive;
|
||||
});
|
||||
fullscreenMulti->OnClick.Add([](UI::EventParams &e) {
|
||||
System_ApplyFullscreenState();
|
||||
|
||||
@@ -126,6 +126,13 @@ bool WindowsVulkanContext::Init(HINSTANCE hInst, HWND hWnd, std::string *error_m
|
||||
draw_ = Draw::T3DCreateVulkanContext(vulkan_, useMultiThreading);
|
||||
|
||||
VkPresentModeKHR presentMode = ConfigPresentModeToVulkan(draw_);
|
||||
|
||||
#ifdef VK_EXT_full_screen_exclusive
|
||||
vulkan_->SetFullScreenExclusiveMode(g_Config.bFullScreen && g_Config.bAllowFullScreenExclusive
|
||||
? VK_FULL_SCREEN_EXCLUSIVE_ALLOWED_EXT
|
||||
: VK_FULL_SCREEN_EXCLUSIVE_DISALLOWED_EXT);
|
||||
#endif
|
||||
|
||||
if (!vulkan_->InitSwapchain(presentMode)) {
|
||||
*error_message = vulkan_->InitError();
|
||||
Shutdown();
|
||||
@@ -169,6 +176,13 @@ void WindowsVulkanContext::Shutdown() {
|
||||
void WindowsVulkanContext::Resize() {
|
||||
draw_->HandleEvent(Draw::Event::LOST_BACKBUFFER, vulkan_->GetBackbufferWidth(), vulkan_->GetBackbufferHeight());
|
||||
VkPresentModeKHR presentMode = ConfigPresentModeToVulkan(draw_);
|
||||
|
||||
#ifdef VK_EXT_full_screen_exclusive
|
||||
vulkan_->SetFullScreenExclusiveMode(g_Config.bFullScreen && g_Config.bAllowFullScreenExclusive
|
||||
? VK_FULL_SCREEN_EXCLUSIVE_ALLOWED_EXT
|
||||
: VK_FULL_SCREEN_EXCLUSIVE_DISALLOWED_EXT);
|
||||
#endif
|
||||
|
||||
vulkan_->InitSwapchain(presentMode);
|
||||
draw_->HandleEvent(Draw::Event::GOT_BACKBUFFER, vulkan_->GetBackbufferWidth(), vulkan_->GetBackbufferHeight());
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user