1
0
Fork 0
forked from fte/fteqw

Vulkan+Wayland fixes (#271)

* Process wayland events with vulkan renderer.

* Handle vulkan offscreen swapchain size selection.
This commit is contained in:
Daniel Svensson 2024-09-06 18:32:13 +02:00 committed by GitHub
parent e62a712ee9
commit 2efeab6a4c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 21 additions and 3 deletions

View file

@ -1489,7 +1489,14 @@ static void WL_SwapBuffers(void)
}
break;
#endif
case QR_VULKAN: //the vulkan stuff handles this itself. FIXME: are we still receiving inputs? no idea!
case QR_VULKAN:
if (pwl_display_dispatch_pending(w.display) < 0)
{
Con_Printf(CON_ERROR "wayland connection was lost. Restarting video\n");
Cbuf_InsertText("vid_restart", RESTRICT_LOCAL, true);
return;
}
break;
default:
break;
}

View file

@ -715,8 +715,19 @@ static qboolean VK_CreateSwapChain(void)
swapinfo.minImageCount = surfcaps.maxImageCount;
if (swapinfo.minImageCount < surfcaps.minImageCount)
swapinfo.minImageCount = surfcaps.minImageCount;
swapinfo.imageExtent.width = surfcaps.currentExtent.width;
swapinfo.imageExtent.height = surfcaps.currentExtent.height;
// With offscreen rendering, the size is not known at first
if (surfcaps.currentExtent.width == UINT32_MAX && surfcaps.currentExtent.height == UINT32_MAX)
{
swapinfo.imageExtent.width = bound(surfcaps.minImageExtent.width, vid.pixelwidth, surfcaps.maxImageExtent.width);
swapinfo.imageExtent.height = bound(surfcaps.minImageExtent.height, vid.pixelheight, surfcaps.maxImageExtent.height);
}
else
{
swapinfo.imageExtent.width = surfcaps.currentExtent.width;
swapinfo.imageExtent.height = surfcaps.currentExtent.height;
}
swapinfo.imageUsage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT|VK_IMAGE_USAGE_TRANSFER_SRC_BIT;
swapinfo.preTransform = surfcaps.currentTransform;//VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR;
if (surfcaps.supportedCompositeAlpha & VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR)