Qt 6.x
The Qt SDK
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 <rhi/qrhi.h>
21
23
25
26class Q_QUICK_PRIVATE_EXPORT QSGRhiLayer : public QSGLayer
27{
29
30public:
33
34 bool updateTexture() override;
35
36 bool hasAlphaChannel() const override;
37 bool hasMipmaps() const override;
38 QSize textureSize() const override { return m_pixelSize; }
39
40 qint64 comparisonKey() const override;
41 QRhiTexture *rhiTexture() const override;
42 void commitTextureOperations(QRhi *rhi, QRhiResourceUpdateBatch *resourceUpdates) override;
43
44 void setItem(QSGNode *item) override;
45 void setRect(const QRectF &logicalRect) override;
46 void setSize(const QSize &pixelSize) override;
47 void setHasMipmaps(bool mipmap) override;
48 void setFormat(Format format) override;
49 void setLive(bool live) override;
50 void setRecursive(bool recursive) override;
51 void setDevicePixelRatio(qreal ratio) override { m_dpr = ratio; }
52 void setMirrorHorizontal(bool mirror) override;
53 void setMirrorVertical(bool mirror) override;
54 QRectF normalizedTextureSubRect() const override;
55 void setSamples(int samples) override { m_samples = samples; }
56
57 void scheduleUpdate() override;
58 QImage toImage() const override;
59
60public Q_SLOTS:
61 void markDirtyTexture() override;
62 void invalidated() override;
63
64private:
65 void grab();
66 void releaseResources();
67
68 QSGNode *m_item = nullptr;
69 QRectF m_logicalRect;
70 QSize m_pixelSize;
71 qreal m_dpr = 1;
73
74 QSGRenderer *m_renderer = nullptr;
75 QRhiTexture *m_texture = nullptr;
76 QRhiRenderBuffer *m_ds = nullptr;
77 QRhiRenderBuffer *m_msaaColorBuffer = nullptr;
78 QRhiTexture *m_secondaryTexture = nullptr;
79 QRhiTextureRenderTarget *m_rt = nullptr;
80 QRhiRenderPassDescriptor *m_rtRp = nullptr;
81
82 QSGDefaultRenderContext *m_context = nullptr;
83 QRhi *m_rhi = nullptr;
84 int m_samples = 0;
85
86 uint m_mipmap : 1;
87 uint m_live : 1;
88 uint m_recursive : 1;
89 uint m_dirtyTexture : 1;
90 uint m_multisampling : 1;
91 uint m_grab : 1;
92 uint m_mirrorHorizontal : 1;
93 uint m_mirrorVertical : 1;
94};
95
97
98#endif // QSGRHILAYER_P_H
\inmodule QtGui
Definition qimage.h:37
\inmodule QtCore\reentrant
Definition qrect.h:483
\inmodule QtGui
Definition qrhi.h:1071
\inmodule QtGui
Definition qrhi.h:1119
\inmodule QtGui
Definition qrhi.h:1694
\inmodule QtGui
Definition qrhi.h:1161
\inmodule QtGui
Definition qrhi.h:883
Format
Specifies the texture format.
Definition qrhi.h:902
\inmodule QtGui
Definition qrhi.h:1767
virtual bool updateTexture()=0
Call this function to explicitly update the dynamic texture.
virtual Q_SLOT void markDirtyTexture()=0
virtual void scheduleUpdate()=0
virtual void setRecursive(bool recursive)=0
virtual QImage toImage() const =0
virtual Q_SLOT void invalidated()=0
virtual void setMirrorVertical(bool mirror)=0
virtual void setItem(QSGNode *item)=0
virtual void setMirrorHorizontal(bool mirror)=0
virtual void setLive(bool live)=0
virtual void setFormat(Format format)=0
virtual void setSize(const QSize &pixelSize)=0
virtual void setRect(const QRectF &logicalRect)=0
virtual void setHasMipmaps(bool mipmap)=0
\group qtquick-scenegraph-nodes \title Qt Quick Scene Graph Node classes
Definition qsgnode.h:37
The renderer class is the abstract baseclass used for rendering the QML scene graph.
void setDevicePixelRatio(qreal ratio) override
QSize textureSize() const override
Returns the size of the texture in pixels.
void setSamples(int samples) override
virtual void commitTextureOperations(QRhi *rhi, QRhiResourceUpdateBatch *resourceUpdates)
Call this function to enqueue image upload operations to resourceUpdates, in case there are any pendi...
virtual bool hasMipmaps() const =0
Returns true if the texture data contains mipmap levels.
virtual QRectF normalizedTextureSubRect() const
Returns the rectangle inside textureSize() that this texture represents in normalized coordinates.
virtual bool hasAlphaChannel() const =0
Returns true if the texture data contains an alpha channel.
virtual qint64 comparisonKey() const =0
Returns a key suitable for comparing textures.
virtual QRhiTexture * rhiTexture() const
\inmodule QtCore
Definition qsize.h:25
Format
Definition ddsheader.h:14
Combined button and popup list for selecting options.
static void * context
GLsizei samples
GLint GLsizei GLsizei GLenum format
#define Q_OBJECT
#define Q_SLOTS
unsigned int uint
Definition qtypes.h:29
long long qint64
Definition qtypes.h:55
double qreal
Definition qtypes.h:92
QGraphicsItem * item