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
qohosvulkansurface.h
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
4#ifndef QOHOSVULKANSURFACE_H
5#define QOHOSVULKANSURFACE_H
6
7#include <QtCore/qglobal.h>
8#include <native_window/external_window.h>
9#include <vulkan/vulkan.h>
10#include <vulkan/vulkan_ohos.h>
11#include <optional>
12
13QT_BEGIN_NAMESPACE
14
15class QOhosVulkanSurface
16{
17 Q_DISABLE_COPY_MOVE(QOhosVulkanSurface)
18public:
19 QOhosVulkanSurface() = default;
20
21 void setNativeWindowSurface(::OHNativeWindow *nativeWindow);
22 VkSurfaceKHR *tryGetOrCreateVulkanWindowSurface(VkInstance instance,
23 PFN_vkCreateSurfaceOHOS createFn,
24 PFN_vkDestroySurfaceKHR destroyFn);
25
26private:
27 struct VulkanSurface {
28 Q_DISABLE_COPY_MOVE(VulkanSurface)
29 VkInstance instance;
30 VkSurfaceKHR surface;
31 PFN_vkDestroySurfaceKHR destroyFunc;
32 VulkanSurface(VkInstance inst, VkSurfaceKHR surf, PFN_vkDestroySurfaceKHR fn)
33 : instance(inst), surface(surf), destroyFunc(fn)
34 {
35 }
36 ~VulkanSurface() {
37 if (destroyFunc)
38 destroyFunc(instance, surface, nullptr);
39 }
40 };
41
42 ::OHNativeWindow *m_nativeWindow = nullptr;
43 ::OHNativeWindow *m_surfaceNativeWindow = nullptr;
44 std::optional<VulkanSurface> m_vulkanSurface = std::nullopt;
45};
46
47QT_END_NAMESPACE
48
49#endif // QOHOSVULKANSURFACE_H
Combined button and popup list for selecting options.