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>
This commit is contained in:
parent
953512ec84
commit
84491e5551
@ -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)
|
||||
|
@ -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) {
|
||||
|
@ -223,6 +223,7 @@ public:
|
||||
void removeDebugOutputFilter(DebugFilter filter);
|
||||
|
||||
private:
|
||||
friend class QVulkanInstancePrivate;
|
||||
QScopedPointer<QVulkanInstancePrivate> d_ptr;
|
||||
Q_DISABLE_COPY(QVulkanInstance)
|
||||
};
|
||||
|
95
src/gui/vulkan/qvulkaninstance_p.h
Normal file
95
src/gui/vulkan/qvulkaninstance_p.h
Normal file
@ -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
|
Loading…
x
Reference in New Issue
Block a user