| 1 | // Copyright (C) 2020 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 QQUICKRENDERTARGET_P_H |
| 5 | #define QQUICKRENDERTARGET_P_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 | #include <QtQuick/private/qtquickglobal_p.h> |
| 19 | #include "qquickrendertarget.h" |
| 20 | #include <QAtomicInt> |
| 21 | |
| 22 | QT_BEGIN_NAMESPACE |
| 23 | |
| 24 | class QRhi; |
| 25 | struct QQuickWindowRenderTarget; |
| 26 | |
| 27 | class Q_QUICK_EXPORT QQuickRenderTargetPrivate |
| 28 | { |
| 29 | public: |
| 30 | static QQuickRenderTargetPrivate *get(QQuickRenderTarget *rt) { return rt->d; } |
| 31 | static const QQuickRenderTargetPrivate *get(const QQuickRenderTarget *rt) { return rt->d; } |
| 32 | QQuickRenderTargetPrivate(); |
| 33 | QQuickRenderTargetPrivate(const QQuickRenderTargetPrivate &other); |
| 34 | bool resolve(QRhi *rhi, QQuickWindowRenderTarget *dst); |
| 35 | |
| 36 | enum class Type { |
| 37 | Null, |
| 38 | NativeTexture, |
| 39 | NativeTextureArray, |
| 40 | NativeRenderbuffer, |
| 41 | RhiRenderTarget, |
| 42 | PaintDevice |
| 43 | }; |
| 44 | |
| 45 | QAtomicInt ref; |
| 46 | Type type = Type::Null; |
| 47 | QSize pixelSize; |
| 48 | qreal devicePixelRatio = 1.0; |
| 49 | int sampleCount = 1; |
| 50 | struct NativeTexture { |
| 51 | quint64 object; |
| 52 | int layoutOrState; |
| 53 | uint rhiFormat; |
| 54 | uint rhiFormatFlags; |
| 55 | uint rhiViewFormat; |
| 56 | uint rhiViewFormatFlags; |
| 57 | }; |
| 58 | struct NativeTextureArray { |
| 59 | quint64 object; |
| 60 | int layoutOrState; |
| 61 | int arraySize; |
| 62 | uint rhiFormat; |
| 63 | uint rhiFormatFlags; |
| 64 | uint rhiViewFormat; |
| 65 | uint rhiViewFormatFlags; |
| 66 | }; |
| 67 | union { |
| 68 | NativeTexture nativeTexture; |
| 69 | NativeTextureArray nativeTextureArray; |
| 70 | quint64 nativeRenderbufferObject; |
| 71 | QRhiRenderTarget *rhiRt; |
| 72 | QPaintDevice *paintDevice; |
| 73 | } u; |
| 74 | |
| 75 | QRhiTexture *customDepthTexture = nullptr; |
| 76 | bool mirrorVertically = false; |
| 77 | bool multisampleResolve = false; |
| 78 | }; |
| 79 | |
| 80 | QT_END_NAMESPACE |
| 81 | |
| 82 | #endif // QQUICKRENDERTARGET_P_H |
| 83 | |