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
qquickrendertarget.h
Go to the documentation of this file.
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// Qt-Security score:significant reason:default
4
5#ifndef QQUICKRENDERTARGET_H
6#define QQUICKRENDERTARGET_H
7
8#include <QtQuick/qtquickglobal.h>
9#include <QtCore/qsize.h>
10
11#if QT_CONFIG(vulkan)
12#include <QtGui/qvulkaninstance.h>
13#endif
14
15#if QT_CONFIG(metal) || defined(Q_QDOC)
16Q_FORWARD_DECLARE_OBJC_CLASS(MTLTexture);
17#endif
18
19QT_BEGIN_NAMESPACE
20
21class QQuickRenderTargetPrivate;
22class QRhiRenderTarget;
23class QRhiTexture;
24class QPaintDevice;
25
26class Q_QUICK_EXPORT QQuickRenderTarget
27{
28public:
29 enum class Flag {
30 MultisampleResolve = 0x01,
31 };
32 Q_DECLARE_FLAGS(Flags, Flag)
33
34 QQuickRenderTarget();
35 ~QQuickRenderTarget();
36 QQuickRenderTarget(const QQuickRenderTarget &other);
37 QQuickRenderTarget &operator=(const QQuickRenderTarget &other);
38
39 bool isNull() const;
40
41 qreal devicePixelRatio() const;
42 void setDevicePixelRatio(qreal ratio);
43
44 bool mirrorVertically() const;
45 void setMirrorVertically(bool enable);
46
47 QRhiTexture *depthTexture() const;
48 void setDepthTexture(QRhiTexture *texture);
49
50#if QT_CONFIG(opengl) || defined(Q_QDOC)
51 static QQuickRenderTarget fromOpenGLTexture(uint textureId, const QSize &pixelSize, int sampleCount = 1);
52 static QQuickRenderTarget fromOpenGLTexture(uint textureId, uint format, const QSize &pixelSize, int sampleCount = 1);
53 static QQuickRenderTarget fromOpenGLTexture(uint textureId, uint format, QSize pixelSize, int sampleCount, int arraySize, Flags flags);
54
55 static QQuickRenderTarget fromOpenGLRenderBuffer(uint renderbufferId, const QSize &pixelSize, int sampleCount = 1);
56#endif
57
58#if defined(Q_OS_WIN) || defined(Q_QDOC)
59 static QQuickRenderTarget fromD3D11Texture(void *texture, const QSize &pixelSize, int sampleCount = 1);
60 static QQuickRenderTarget fromD3D11Texture(void *texture, uint format, const QSize &pixelSize, int sampleCount = 1);
61 static QQuickRenderTarget fromD3D11Texture(void *texture, uint format, QSize pixelSize, int sampleCount, Flags flags);
62
63 static QQuickRenderTarget fromD3D12Texture(void *texture, int resourceState, uint format, const QSize &pixelSize, int sampleCount = 1);
64 static QQuickRenderTarget fromD3D12Texture(void *texture, int resourceState, uint format, uint viewFormat, QSize pixelSize, int sampleCount, int arraySize, Flags flags);
65#endif
66
67#if QT_CONFIG(metal) || defined(Q_QDOC)
68 static QQuickRenderTarget fromMetalTexture(MTLTexture *texture, const QSize &pixelSize, int sampleCount = 1);
69 static QQuickRenderTarget fromMetalTexture(MTLTexture *texture, uint format, const QSize &pixelSize, int sampleCount = 1);
70 static QQuickRenderTarget fromMetalTexture(MTLTexture *texture, uint format, uint viewFormat, QSize pixelSize, int sampleCount, int arraySize, Flags flags);
71#endif
72
73#if QT_CONFIG(vulkan) || defined(Q_QDOC)
74 static QQuickRenderTarget fromVulkanImage(VkImage image, VkImageLayout layout, const QSize &pixelSize, int sampleCount = 1);
75 static QQuickRenderTarget fromVulkanImage(VkImage image, VkImageLayout layout, VkFormat format, const QSize &pixelSize, int sampleCount = 1);
76 static QQuickRenderTarget fromVulkanImage(VkImage image, VkImageLayout layout, VkFormat format, VkFormat viewFormat, QSize pixelSize, int sampleCount, int arraySize, Flags flags);
77#endif
78
79 static QQuickRenderTarget fromRhiRenderTarget(QRhiRenderTarget *renderTarget);
80
81 static QQuickRenderTarget fromPaintDevice(QPaintDevice *device);
82
83private:
84 void detach();
85 bool isEqual(const QQuickRenderTarget &other) const noexcept;
86 QQuickRenderTargetPrivate *d;
87 friend class QQuickRenderTargetPrivate;
88
89 friend bool operator==(const QQuickRenderTarget &lhs, const QQuickRenderTarget &rhs) noexcept
90 { return lhs.isEqual(rhs); }
91 friend bool operator!=(const QQuickRenderTarget &lhs, const QQuickRenderTarget &rhs) noexcept
92 { return !lhs.isEqual(rhs); }
93};
94
95Q_DECLARE_OPERATORS_FOR_FLAGS(QQuickRenderTarget::Flags)
96
97QT_END_NAMESPACE
98
99#endif // QQUICKRENDERTARGET_H
The QQuickRenderTarget class provides an opaque container for native graphics resources specifying a ...
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
Definition qrhi.h:577
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
Definition qrhi.h:621
static bool createRhiRenderTargetWithRenderBuffer(QRhiRenderBuffer *renderBuffer, const QSize &pixelSize, int sampleCount, QRhi *rhi, QQuickWindowRenderTarget *dst)
static bool createRhiRenderTargetWithDepthTexture(QRhiTexture *texture, QRhiTexture *depthTexture, const QSize &pixelSize, int sampleCount, bool multisampleResolve, QRhi *rhi, QQuickWindowRenderTarget *dst)
static bool createRhiRenderTargetMultiView(QRhiTexture *texture, QRhiTexture *maybeCustomDepthTexture, const QSize &pixelSize, int arraySize, int sampleCount, bool multisampleResolve, QRhi *rhi, QQuickWindowRenderTarget *dst)
static bool createRhiRenderTarget(QRhiTexture *texture, const QSize &pixelSize, int sampleCount, bool multisampleResolve, QRhi *rhi, QQuickWindowRenderTarget *dst)