Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
qsgmaterial.cpp
Go to the documentation of this file.
1// Copyright (C) 2016 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#include "qsgmaterial.h"
5#include "qsgrenderer_p.h"
6
8
9#ifndef QT_NO_DEBUG
12{
13 bool fail = qsg_material_failure;
15 return fail;
16}
17
19{
21}
22#endif
23
33#ifndef QT_NO_DEBUG
34static int qt_material_count = 0;
35
37{
38 qDebug("Number of leaked materials: %i", qt_material_count);
40}
41#endif
42
105{
106 Q_UNUSED(m_reserved);
107#ifndef QT_NO_DEBUG
108 if (_q_sg_leak_check) {
110 static bool atexit_registered = false;
111 if (!atexit_registered) {
113 atexit_registered = true;
114 }
115 }
116#endif
117}
118
119
125{
126#ifndef QT_NO_DEBUG
127 if (_q_sg_leak_check) {
129 if (qt_material_count < 0)
130 qDebug("Material destroyed after qt_print_material_count() was called.");
131 }
132#endif
133}
134
135
136
180{
181 if (on)
182 m_flags |= flags;
183 else
184 m_flags &= ~flags;
185}
186
187
188
203{
204 Q_ASSERT(other && type() == other->type());
205 const qintptr diff = qintptr(this) - qintptr(other);
206 return diff < 0 ? -1 : (diff > 0 ? 1 : 0);
207}
208
209
210
The QSGMaterial class encapsulates rendering state for a shader program.
Definition qsgmaterial.h:15
QSGMaterial::Flags flags() const
Returns the material's flags.
Definition qsgmaterial.h:40
virtual int compare(const QSGMaterial *other) const
Compares this material to other and returns 0 if they are equal; -1 if this material should sort befo...
virtual QSGMaterialType * type() const =0
This function is called by the scene graph to query an identifier that is unique to the QSGMaterialSh...
virtual ~QSGMaterial()
void setFlag(Flags flags, bool on=true)
Sets the flags flags on this material if on is true; otherwise clears the attribute.
Combined button and popup list for selecting options.
Flags
#define qDebug
[1]
Definition qlogging.h:160
GLbitfield flags
#define Q_ASSERT(cond)
Definition qrandom.cpp:47
void qsg_set_material_failure()
static int qt_material_count
\group qtquick-scenegraph-materials \title Qt Quick Scene Graph Material Classes
static void qt_print_material_count()
bool qsg_test_and_clear_material_failure()
QT_BEGIN_NAMESPACE bool qsg_material_failure
bool _q_sg_leak_check
#define Q_UNUSED(x)
ptrdiff_t qintptr
Definition qtypes.h:71
QSharedPointer< T > other(t)
[5]