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
qsgrhilayer_p.h
Go to the documentation of this file.
1// Copyright (C) 2019 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#ifndef QSGRHILAYER_P_H
4#define QSGRHILAYER_P_H
5
6//
7// W A R N I N G
8// -------------
9//
10// This file is not part of the Qt API. It exists purely as an
11// implementation detail. This header file may change from version to
12// version without notice, or even be removed.
13//
14// We mean it.
15//
16
17#include <private/qsgadaptationlayer_p.h>
18#include <private/qsgcontext_p.h>
19#include <private/qsgtexture_p.h>
20#include <private/qsgdefaultrendercontext_p.h>
21#include <rhi/qrhi.h>
22
24
25class QSGDefaultRenderContext;
26
27class Q_QUICK_EXPORT QSGRhiLayer : public QSGLayer
28{
29 Q_OBJECT
30
31public:
32 QSGRhiLayer(QSGRenderContext *context);
33 ~QSGRhiLayer();
34
35 bool updateTexture() override;
36
37 bool hasAlphaChannel() const override;
38 bool hasMipmaps() const override;
39 QSize textureSize() const override { return m_pixelSize; }
40
41 qint64 comparisonKey() const override;
42 QRhiTexture *rhiTexture() const override;
43 void commitTextureOperations(QRhi *rhi, QRhiResourceUpdateBatch *resourceUpdates) override;
44
45 void setItem(QSGNode *item) override;
46 void setRect(const QRectF &logicalRect) override;
47 void setSize(const QSize &pixelSize) override;
48 void setHasMipmaps(bool mipmap) override;
49 void setFormat(Format format) override;
50 void setLive(bool live) override;
51 void setRecursive(bool recursive) override;
52 void setDevicePixelRatio(qreal ratio) override { m_dpr = ratio; }
53 void setMirrorHorizontal(bool mirror) override;
54 void setMirrorVertical(bool mirror) override;
55 QRectF normalizedTextureSubRect() const override;
56 void setSamples(int samples) override { m_samples = samples; }
57
58 void scheduleUpdate() override;
59 QImage toImage() const override;
60
61public Q_SLOTS:
62 void markDirtyTexture() override;
63 void invalidated() override;
64
65private:
66 void grab();
67 void releaseResources();
68 void clearMainTexture();
69
70 QSGNode *m_item = nullptr;
71 QRectF m_logicalRect;
72 QSize m_pixelSize;
73 qreal m_dpr = 1;
74 QRhiTexture::Format m_format = QRhiTexture::RGBA8;
75
76 QSGRenderer *m_renderer = nullptr;
77 QRhiTexture *m_texture = nullptr;
78 QRhiTexture *m_prevTexture = nullptr;
79 QSharedPointer<QSGDepthStencilBuffer> m_ds;
80 QRhiRenderBuffer *m_msaaColorBuffer = nullptr;
81 QRhiTexture *m_secondaryTexture = nullptr;
82 QRhiTextureRenderTarget *m_rt = nullptr;
83 QRhiRenderPassDescriptor *m_rtRp = nullptr;
84
85 QSGDefaultRenderContext *m_context = nullptr;
86 QRhi *m_rhi = nullptr;
87 int m_samples = 0;
88
89 uint m_mipmap : 1;
90 uint m_live : 1;
91 uint m_recursive : 1;
92 uint m_dirtyTexture : 1;
93 uint m_multisampling : 1;
94 uint m_grab : 1;
95 uint m_mirrorHorizontal : 1;
96 uint m_mirrorVertical : 1;
97};
98
99QT_END_NAMESPACE
100
101#endif // QSGRHILAYER_P_H