27 initInstance(m_instance, QByteArrayList() << QByteArrayLiteral(
"VK_QNX_screen_surface"));
32 m_getPhysDevScreenPresSupport =
33 reinterpret_cast<PFN_vkGetPhysicalDeviceScreenPresentationSupportQNX>(
34 m_vkGetInstanceProcAddr(m_vkInst,
35 "vkGetPhysicalDeviceScreenPresentationSupportQNX"));
36 if (!m_getPhysDevScreenPresSupport)
37 qCWarning(lcQpaQnxVulkan,
"Failed to find vkGetPhysicalDeviceScreenPresentationSupportQNX");
41 uint32_t queueFamilyIndex,
44 if (window->surfaceType() != QSurface::VulkanSurface) {
45 qCWarning(lcQpaQnxVulkan,
"supportsPresent: called on non-Vulkan window");
51 if (m_getPhysDevScreenPresSupport) {
54 qCWarning(lcQpaQnxVulkan,
"supportsPresent: window has no platform handle");
57 return m_getPhysDevScreenPresSupport(physicalDevice, queueFamilyIndex, w->nativeHandle());
61 if (m_getPhysDevSurfaceSupport) {
62 VkSurfaceKHR surface = QVulkanInstance::surfaceForWindow(window);
64 VkBool32 supported =
false;
65 VkResult err = m_getPhysDevSurfaceSupport(physicalDevice, queueFamilyIndex, surface, &supported);
66 if (err != VK_SUCCESS) {
67 qCWarning(lcQpaQnxVulkan,
"vkGetPhysicalDeviceSurfaceSupportKHR failed: %d", err);
70 return bool(supported);
79 VkSurfaceKHR surface = VK_NULL_HANDLE;
82 qCWarning(lcQpaQnxVulkan,
"createSurface: Vulkan instance not available");
83 return VK_NULL_HANDLE;
86 if (!m_createSurface) {
87 m_createSurface =
reinterpret_cast<PFN_vkCreateScreenSurfaceQNX>(
88 m_vkGetInstanceProcAddr(m_vkInst,
"vkCreateScreenSurfaceQNX"));
90 if (!m_createSurface) {
91 qCWarning(lcQpaQnxVulkan,
"Failed to find vkCreateScreenSurfaceQNX");
95 if (!window->nativeHandle()) {
96 qCWarning(lcQpaQnxVulkan,
"Window has no native screen_window_t handle");
100 VkScreenSurfaceCreateInfoQNX surfaceInfo;
101 memset(&surfaceInfo, 0,
sizeof(surfaceInfo));
102 surfaceInfo.sType = VK_STRUCTURE_TYPE_SCREEN_SURFACE_CREATE_INFO_QNX;
103 surfaceInfo.context = window->screenContext();
104 surfaceInfo.window = window->nativeHandle();
106 VkResult err = m_createSurface(m_vkInst, &surfaceInfo,
nullptr, &surface);
108 if (err != VK_SUCCESS) {
109 qCWarning(lcQpaQnxVulkan,
"Failed to create Vulkan screen surface: %d", err);
111 qCDebug(lcQpaQnxVulkan,
"Created Vulkan surface %p for window %p", surface, window->nativeHandle());