1 | // Copyright (C) 2024 The Qt Company Ltd. |
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only |
3 | |
4 | #ifndef QABSTRACTOPENXRGRAPHICS_H |
5 | #define QABSTRACTOPENXRGRAPHICS_H |
6 | |
7 | // |
8 | // W A R N I N G |
9 | // ------------- |
10 | // |
11 | // This file is not part of the Qt API. It exists purely as an |
12 | // implementation detail. This header file may change from version to |
13 | // version without notice, or even be removed. |
14 | // |
15 | // We mean it. |
16 | // |
17 | |
18 | |
19 | #include <QtQuick3DXr/qtquick3dxrglobal.h> |
20 | |
21 | #include <openxr/openxr.h> |
22 | #include <QtCore/QVector> |
23 | #include <QtQuick/QQuickRenderTarget> |
24 | |
25 | QT_BEGIN_NAMESPACE |
26 | |
27 | class QRhi; |
28 | class QQuickWindow; |
29 | class QQuickGraphicsConfiguration; |
30 | |
31 | class QAbstractOpenXRGraphics |
32 | { |
33 | public: |
34 | QAbstractOpenXRGraphics(); |
35 | virtual ~QAbstractOpenXRGraphics() { } |
36 | |
37 | virtual bool isExtensionSupported(const QVector<XrExtensionProperties> &extensions) const = 0; |
38 | virtual const char *extensionName() const = 0; |
39 | virtual const XrBaseInStructure* handle() const = 0; |
40 | virtual bool setupGraphics(const XrInstance &instance, |
41 | XrSystemId &systemId, |
42 | const QQuickGraphicsConfiguration &quickConfig) = 0; |
43 | virtual void setupWindow(QQuickWindow *); |
44 | virtual bool finializeGraphics(QRhi *rhi) = 0; |
45 | virtual int64_t colorSwapchainFormat(const QVector<int64_t> &swapchainFormats) const = 0; |
46 | virtual int64_t depthSwapchainFormat(const QVector<int64_t> &swapchainFormats) const = 0; |
47 | virtual QVector<XrSwapchainImageBaseHeader*> allocateSwapchainImages(int count, |
48 | XrSwapchain swapchain) = 0; |
49 | |
50 | virtual QQuickRenderTarget (const XrSwapchainSubImage &subImage, |
51 | const XrSwapchainImageBaseHeader *swapchainImage, |
52 | quint64 swapchainFormat, |
53 | int samples, |
54 | int arraySize, |
55 | const XrSwapchainImageBaseHeader *depthSwapchainImage, |
56 | quint64 depthSwapchainFormat) const = 0; |
57 | |
58 | virtual QRhi *rhi() const = 0; |
59 | virtual void releaseResources() { } |
60 | }; |
61 | |
62 | QT_END_NAMESPACE |
63 | |
64 | #endif // QABSTRACTOPENXRGRAPHICS_H |
65 | |