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
qxcbvulkanwindow.cpp
Go to the documentation of this file.
1
// Copyright (C) 2017 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
"qxcbvulkanwindow.h"
6
7
QT_BEGIN_NAMESPACE
8
9
QXcbVulkanWindow
::
QXcbVulkanWindow
(
QWindow
*
window
)
10
: QXcbWindow(window),
11
m_surface(VK_NULL_HANDLE)
12
{
13
}
14
15
QXcbVulkanWindow::~QXcbVulkanWindow()
16
{
17
if
(m_surface) {
18
QVulkanInstance *inst = window()->vulkanInstance();
19
if
(inst)
20
static_cast
<QXcbVulkanInstance *>(inst->handle())->destroySurface(m_surface);
21
}
22
}
23
24
void
QXcbVulkanWindow
::
resolveFormat
(
const
QSurfaceFormat &format)
25
{
26
m_format = format;
27
if
(m_format.redBufferSize() <= 0)
28
m_format.setRedBufferSize(8);
29
if
(m_format.greenBufferSize() <= 0)
30
m_format.setGreenBufferSize(8);
31
if
(m_format.blueBufferSize() <= 0)
32
m_format.setBlueBufferSize(8);
33
}
34
35
// No createVisual() needed, use the default that picks one based on the R/G/B/A size.
36
37
VkSurfaceKHR
*
QXcbVulkanWindow
::
surface
()
38
{
39
if
(m_surface)
40
return
&m_surface;
41
42
QVulkanInstance *inst = window()->vulkanInstance();
43
if
(!inst) {
44
qWarning(
"Attempted to create Vulkan surface without an instance; was QWindow::setVulkanInstance() called?"
);
45
return
nullptr
;
46
}
47
QXcbVulkanInstance
*xcbinst =
static_cast
<
QXcbVulkanInstance
*>(inst->handle());
48
m_surface = xcbinst->createSurface(
this
);
49
50
return
&m_surface;
51
}
52
53
QT_END_NAMESPACE
QWindow
\inmodule QtGui
Definition
qwindow.h:63
QXcbVulkanInstance
Definition
qxcbvulkaninstance.h:21
QXcbVulkanWindow
Definition
qxcbvulkanwindow.h:13
QXcbVulkanWindow::surface
VkSurfaceKHR * surface()
Definition
qxcbvulkanwindow.cpp:37
QXcbVulkanWindow::resolveFormat
void resolveFormat(const QSurfaceFormat &format) override
Definition
qxcbvulkanwindow.cpp:24
QPlatformGraphicsBufferHelper
\inmodule QtGui
qtbase
src
plugins
platforms
xcb
qxcbvulkanwindow.cpp
Generated on
for Qt by
1.14.0