[KMSDRM] For Vulkan, use a mode with the same exact size as the window, if possible, or create a new one.

main
Vanfanel 2021-03-27 22:50:18 +01:00 committed by Sam Lantinga
parent 07ba13b7a9
commit c13c3c37bd
1 changed files with 5 additions and 4 deletions

View File

@ -367,14 +367,15 @@ SDL_bool KMSDRM_Vulkan_CreateSurface(_THIS,
planes_props = SDL_malloc(sizeof(VkDisplayPlanePropertiesKHR) * plane_count);
vkGetPhysicalDeviceDisplayPlanePropertiesKHR(gpu, &plane_count, planes_props);
/* Get a video mode equal or smaller than the window size. REMEMBER:
We have to get a small enough videomode for the window size,
/* Get a video mode equal to the window size among the predefined ones,
if possible.
REMEMBER: We have to get a small enough videomode for the window size,
because videomode determines how big the scanout region is and we can't
scanout a region bigger than the window (we would be reading past the
buffer, and Vulkan would give us a confusing VK_ERROR_SURFACE_LOST_KHR). */
for (i = 0; i < mode_count; i++) {
if (modes_props[i].parameters.visibleRegion.width <= window->w &&
modes_props[i].parameters.visibleRegion.height <= window->h)
if (modes_props[i].parameters.visibleRegion.width == window->w &&
modes_props[i].parameters.visibleRegion.height == window->h)
{
display_mode_props = modes_props[i];
mode_found = SDL_TRUE;