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
7
#
include
"qqnxvulkanwindow.h"
8
#
include
"qqnxintegration.h"
9
10
#
include
<
QtGui
/
QVulkanInstance
>
11
12
QT_BEGIN_NAMESPACE
13
14
QQnxVulkanWindow
::
QQnxVulkanWindow
(
QWindow
*
window
,
screen_context_t
context
,
bool
needRootWindow
)
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
30
QQnxVulkanWindow::~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
40
int
QQnxVulkanWindow
::
pixelFormat
()
const
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
47
VkSurfaceKHR
*
QQnxVulkanWindow
::
surface
()
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
63
QT_END_NAMESPACE
QQnxVulkanWindow
Definition
qqnxvulkanwindow.h:13
QQnxVulkanWindow::surface
VkSurfaceKHR * surface()
Definition
qqnxvulkanwindow.cpp:47
QQnxVulkanWindow::pixelFormat
int pixelFormat() const override
Definition
qqnxvulkanwindow.cpp:40
QQnxWindow
The QQnxWindow is the base class of the various classes used as instances of QPlatformWindow in the Q...
Definition
qqnxwindow.h:31
QWindow
\inmodule QtGui
Definition
qwindow.h:64
QT_BEGIN_NAMESPACE
Combined button and popup list for selecting options.
Definition
qrandomaccessasyncfile_darwin.mm:17
Q_SCREEN_CHECKERROR
#define Q_SCREEN_CHECKERROR(x, message)
Definition
qqnxglobal.h:13
qtbase
src
plugins
platforms
qnx
qqnxvulkanwindow.cpp
Generated on
for Qt by
1.16.1