summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJiDe Zhang <zhangjide@uniontech.com>2022-05-01 22:55:58 +0800
committerJiDe Zhang <zhangjide@uniontech.com>2022-05-04 20:14:49 +0800
commit84491e555134ee7a5ae0d8cfec4b2e7a0cfe56cc (patch)
tree6671a0bb3a20f1122ee1cfe43b4de9c7c213d20c
parent953512ec84f04e7a8c7c8ac2410ba6c6f34de2b8 (diff)
Export the QVulkanInstancePrivate class
When needs by the QVulkanInstance::setVkInstance to use a existing VkInstance to a QQuickWindow, the VkInstance maybe is from a non Qt render system, in the case, the QPlatformVulkanInstance object of QVulkanInstance is can't create from the QPA, the all vulkan information is need get from the VkInstance owner(eg, getInstanceProcAddr). But providing it with a public interface is not a good idea, so by exporting a private class, you can use a private interface where needed to achieve the above purpose. Task-number: QTBUG-103021 Change-Id: I0312adcf55cfd7d49889ed112ab237c0b3ab3ef6 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
-rw-r--r--src/gui/CMakeLists.txt2
-rw-r--r--src/gui/vulkan/qvulkaninstance.cpp29
-rw-r--r--src/gui/vulkan/qvulkaninstance.h1
-rw-r--r--src/gui/vulkan/qvulkaninstance_p.h95
4 files changed, 98 insertions, 29 deletions
diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt
index e9a07f124e..b1795842f4 100644
--- a/src/gui/CMakeLists.txt
+++ b/src/gui/CMakeLists.txt
@@ -880,7 +880,7 @@ qt_internal_extend_target(Gui CONDITION QT_FEATURE_vulkan
vulkan/qplatformvulkaninstance.cpp vulkan/qplatformvulkaninstance.h
vulkan/qvulkandefaultinstance.cpp vulkan/qvulkandefaultinstance_p.h
vulkan/qvulkanfunctions.cpp
- vulkan/qvulkaninstance.cpp vulkan/qvulkaninstance.h
+ vulkan/qvulkaninstance.cpp vulkan/qvulkaninstance.h vulkan/qvulkaninstance_p.h
vulkan/qvulkanwindow.cpp vulkan/qvulkanwindow.h vulkan/qvulkanwindow_p.h
)
if(QT_FEATURE_vulkan)
diff --git a/src/gui/vulkan/qvulkaninstance.cpp b/src/gui/vulkan/qvulkaninstance.cpp
index aaa8691273..05353e36c2 100644
--- a/src/gui/vulkan/qvulkaninstance.cpp
+++ b/src/gui/vulkan/qvulkaninstance.cpp
@@ -37,8 +37,7 @@
**
****************************************************************************/
-#include "qvulkaninstance.h"
-#include <private/qvulkanfunctions_p.h>
+#include "qvulkaninstance_p.h"
#include <qpa/qplatformvulkaninstance.h>
#include <qpa/qplatformintegration.h>
#include <qpa/qplatformnativeinterface.h>
@@ -245,32 +244,6 @@ QT_BEGIN_NAMESPACE
\value NoDebugOutputRedirect Disables Vulkan debug output (\c{VK_EXT_debug_report}) redirection to qDebug.
*/
-class QVulkanInstancePrivate
-{
-public:
- QVulkanInstancePrivate(QVulkanInstance *q)
- : q_ptr(q),
- vkInst(VK_NULL_HANDLE),
- errorCode(VK_SUCCESS)
- { }
- ~QVulkanInstancePrivate() { reset(); }
-
- bool ensureVulkan();
- void reset();
-
- QVulkanInstance *q_ptr;
- QScopedPointer<QPlatformVulkanInstance> platformInst;
- VkInstance vkInst;
- QVulkanInstance::Flags flags;
- QByteArrayList layers;
- QByteArrayList extensions;
- QVersionNumber apiVersion;
- VkResult errorCode;
- QScopedPointer<QVulkanFunctions> funcs;
- QHash<VkDevice, QVulkanDeviceFunctions *> deviceFuncs;
- QList<QVulkanInstance::DebugFilter> debugFilters;
-};
-
bool QVulkanInstancePrivate::ensureVulkan()
{
if (!platformInst) {
diff --git a/src/gui/vulkan/qvulkaninstance.h b/src/gui/vulkan/qvulkaninstance.h
index bfdaf1ab69..156d6cebfc 100644
--- a/src/gui/vulkan/qvulkaninstance.h
+++ b/src/gui/vulkan/qvulkaninstance.h
@@ -223,6 +223,7 @@ public:
void removeDebugOutputFilter(DebugFilter filter);
private:
+ friend class QVulkanInstancePrivate;
QScopedPointer<QVulkanInstancePrivate> d_ptr;
Q_DISABLE_COPY(QVulkanInstance)
};
diff --git a/src/gui/vulkan/qvulkaninstance_p.h b/src/gui/vulkan/qvulkaninstance_p.h
new file mode 100644
index 0000000000..c52677da37
--- /dev/null
+++ b/src/gui/vulkan/qvulkaninstance_p.h
@@ -0,0 +1,95 @@
+/****************************************************************************
+**
+** Copyright (C) 2022 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QVULKANINSTANCE_P_H
+#define QVULKANINSTANCE_P_H
+
+#include <QtGui/private/qtguiglobal_p.h>
+
+#if QT_CONFIG(vulkan) || defined(Q_CLANG_QDOC)
+
+#include "qvulkaninstance.h"
+#include <private/qvulkanfunctions_p.h>
+#include <QtCore/QHash>
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of a number of Qt sources files. This header file may change from
+// version to version without notice, or even be removed.
+//
+// We mean it.
+//
+
+QT_BEGIN_NAMESPACE
+
+class Q_GUI_EXPORT QVulkanInstancePrivate
+{
+public:
+ QVulkanInstancePrivate(QVulkanInstance *q)
+ : q_ptr(q),
+ vkInst(VK_NULL_HANDLE),
+ errorCode(VK_SUCCESS)
+ { }
+ ~QVulkanInstancePrivate() { reset(); }
+ static QVulkanInstancePrivate *get(QVulkanInstance *q) { return q->d_ptr.data(); }
+
+ bool ensureVulkan();
+ void reset();
+
+ QVulkanInstance *q_ptr;
+ QScopedPointer<QPlatformVulkanInstance> platformInst;
+ VkInstance vkInst;
+ QVulkanInstance::Flags flags;
+ QByteArrayList layers;
+ QByteArrayList extensions;
+ QVersionNumber apiVersion;
+ VkResult errorCode;
+ QScopedPointer<QVulkanFunctions> funcs;
+ QHash<VkDevice, QVulkanDeviceFunctions *> deviceFuncs;
+ QList<QVulkanInstance::DebugFilter> debugFilters;
+};
+
+QT_END_NAMESPACE
+
+#endif // QT_CONFIG(vulkan)
+
+#endif // QVULKANINSTANCE_P_H