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// Qt-Security score:significant reason:default
4#ifndef QSGRHILAYER_P_H
5#define QSGRHILAYER_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 <private/qsgadaptationlayer_p.h>
19#include <private/qsgcontext_p.h>
20#include <private/qsgtexture_p.h>
21#include <private/qsgdefaultrendercontext_p.h>
22#include <rhi/qrhi.h>
23
25
26class QSGDefaultRenderContext;
27
28class Q_QUICK_EXPORT QSGRhiLayer : public QSGLayer
29{
30 Q_OBJECT
31
32public:
33 QSGRhiLayer(QSGRenderContext *context);
34 ~QSGRhiLayer();
35
36 bool updateTexture() override;
37
38 bool hasAlphaChannel() const override;
39 bool hasMipmaps() const override;
40 QSize textureSize() const override { return m_pixelSize; }
41
42 qint64 comparisonKey() const override;
43 QRhiTexture *rhiTexture() const override;
44 void commitTextureOperations(QRhi *rhi, QRhiResourceUpdateBatch *resourceUpdates) override;
45
46 void setItem(QSGNode *item) override;
47 void setRect(const QRectF &logicalRect) override;
48 void setSize(const QSize &pixelSize) override;
49 void setHasMipmaps(bool mipmap) override;
50 void setFormat(Format format) override;
51 void setLive(bool live) override;
52 void setRecursive(bool recursive) override;
53 void setDevicePixelRatio(qreal ratio) override { m_dpr = ratio; }
54 void setMirrorHorizontal(bool mirror) override;
55 void setMirrorVertical(bool mirror) override;
56 QRectF normalizedTextureSubRect() const override;
57 void setSamples(int samples) override { m_samples = samples; }
58
59 void scheduleUpdate() override;
60 QImage toImage() const override;
61
62public Q_SLOTS:
63 void markDirtyTexture() override;
64 void invalidated() override;
65
66private:
67 void grab();
68 void releaseResources();
69 void clearMainTexture();
70
71 QSGNode *m_item = nullptr;
72 QRectF m_logicalRect;
73 QSize m_pixelSize;
74 qreal m_dpr = 1;
75 QRhiTexture::Format m_format = QRhiTexture::RGBA8;
76
77 QSGRenderer *m_renderer = nullptr;
78 QRhiTexture *m_texture = nullptr;
79 QRhiTexture *m_prevTexture = nullptr;
80 QSharedPointer<QSGDepthStencilBuffer> m_ds;
81 QRhiRenderBuffer *m_msaaColorBuffer = nullptr;
82 QRhiTexture *m_secondaryTexture = nullptr;
83 QRhiTextureRenderTarget *m_rt = nullptr;
84 QRhiRenderPassDescriptor *m_rtRp = nullptr;
85
86 QSGDefaultRenderContext *m_context = nullptr;
87 QRhi *m_rhi = nullptr;
88 int m_samples = 0;
89
90 uint m_mipmap : 1;
91 uint m_live : 1;
92 uint m_recursive : 1;
93 uint m_dirtyTexture : 1;
94 uint m_multisampling : 1;
95 uint m_grab : 1;
96 uint m_mirrorHorizontal : 1;
97 uint m_mirrorVertical : 1;
98};
99
100QT_END_NAMESPACE
101
102#endif // QSGRHILAYER_P_H
Combined button and popup list for selecting options.