Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qqnxvulkanwindow.cpp
Go to the documentation of this file.
1// Copyright (C) 2026 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3// Qt-Security score:significant reason:default
4
5#include "qqnxglobal.h"
6
9
10#include <QtGui/QVulkanInstance>
11
13
15 : QQnxWindow(window, context, needRootWindow),
16 m_surface(VK_NULL_HANDLE)
17{
18 // Set Vulkan usage on the screen window before initializing.
19 // This must be done before any swapchain/buffer creation.
20 int usage = SCREEN_USAGE_VULKAN;
21
22 Q_SCREEN_CHECKERROR(screen_set_window_property_iv(nativeHandle(), SCREEN_PROPERTY_USAGE, &usage),
23 "Failed to set vulkan usage");
24
25 initWindow();
26
27 qCDebug(lcQpaQnxVulkan, "Created Vulkan window %p", nativeHandle());
28}
29
30QQnxVulkanWindow::~QQnxVulkanWindow()
31{
32 if (m_surface != VK_NULL_HANDLE) {
33 QVulkanInstance *inst = window()->vulkanInstance();
34 if (inst)
35 static_cast<QQnxVulkanInstance *>(inst->handle())->destroySurface(m_surface);
36 m_surface = VK_NULL_HANDLE;
37 }
38}
39
41{
42 // Return -1 to prevent QQnxWindow::setBufferSize from creating screen buffers.
43 // Vulkan manages its own swapchain buffers via the VkSwapchainKHR.
44 return -1;
45}
46
48{
49 if (m_surface != VK_NULL_HANDLE)
50 return &m_surface;
51
52 QVulkanInstance *inst = window()->vulkanInstance();
53 if (!inst) {
54 qCWarning(lcQpaQnxVulkan, "Attempted to create Vulkan surface without a QVulkanInstance; "
55 "was QWindow::setVulkanInstance() called?");
56 return nullptr;
57 }
58
59 m_surface = static_cast<QQnxVulkanInstance *>(inst->handle())->createSurface(this);
60 return &m_surface;
61}
62
63QT_END_NAMESPACE
VkSurfaceKHR * surface()
int pixelFormat() const override
The QQnxWindow is the base class of the various classes used as instances of QPlatformWindow in the Q...
Definition qqnxwindow.h:31
\inmodule QtGui
Definition qwindow.h:64
Combined button and popup list for selecting options.
#define Q_SCREEN_CHECKERROR(x, message)
Definition qqnxglobal.h:13