JKSunny / EternalJK

Effort to maintain and improve OpenJK
GNU General Public License v2.0
11 stars 1 forks source link

Vulkan: Using window scaling on Windows results in a white screen when switching from r_fullscreen 1 to r_fullscreen 0. #15

Open Alereon opened 6 months ago

Alereon commented 6 months ago

Operating system and version: Windows 10 22H2 (OS Build 19045.4096)

Description of the bug (and if possible, steps to reproduce the bug): When having window scaling set to something higher than 100%, the game window turns into a bright white screen when switching from r_fullscreen 1 to r_fullscreen 0. The console also gets spammed with the following messages:

vk_present_frame(): restarting swapchain...
vk_present_frame(): restarting swapchain...
----- Presentation modes -----
 FIFO
 FIFO_RELAXED
 MAILBOX
 IMMEDIATE
selected presentation mode: IMMEDIATE, image count: 3

steps to reproduce: 1) Turn on window scaling to e.g 125%. 2) Launch the game using r_fullscreen 1. 3) On the main menu, set r_fullscreen 1 to 0. 4) Execute /vid_restart. 5) The game window turns completely white.

What did you expect to happen instead? Seeing the game's main menu instead of a bright white screen.

Alereon commented 6 months ago

Managed to grab the following validation error:

{1284057537} - {VUID-VkSwapchainCreateInfoKHR-pNext-07781}: {Validation Error: [ VUID-VkSwapchainCreateInfoKHR-pNext-07781 ] | MessageID = 0x4c8929c1 | vkCreateSwapchainKHR(): pCreateInfo->imageExtent (3840, 2160), which is outside the bounds returned by vkGetPhysicalDeviceSurfaceCapabilitiesKHR(): currentExtent = (3832,2135), minImageExtent = (3832,2135), maxImageExtent = (3832,2135). The Vulkan spec states: If a VkSwapchainPresentScalingCreateInfoEXT structure was not included in the pNext chain, or it is included and VkSwapchainPresentScalingCreateInfoEXT::scalingBehavior is zero then imageExtent must be between minImageExtent and maxImageExtent, inclusive, where minImageExtent and maxImageExtent are members of the VkSurfaceCapabilitiesKHR structure returned by vkGetPhysicalDeviceSurfaceCapabilitiesKHR for the surface (https://vulkan.lunarg.com/doc/view/1.3.275.0/windows/1.3-extensions/vkspec.html#VUID-VkSwapchainCreateInfoKHR-pNext-07781)}