Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
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
10
11#ifndef QT_NO_DEBUG
14{
15 bool fail = qsg_material_failure;
17 return fail;
18}
19
24#endif
25
35#ifndef QT_NO_DEBUG
36static int qt_material_count = 0;
37
39{
40 qCDebug(lcQsgLeak, "Number of leaked materials: %i", qt_material_count);
42}
43#endif
44
107{
108 Q_UNUSED(m_reserved);
109#ifndef QT_NO_DEBUG
110 if (lcQsgLeak().isDebugEnabled()) {
112 static bool atexit_registered = false;
113 if (!atexit_registered) {
115 atexit_registered = true;
116 }
117 }
118#endif
119}
120
121
127{
128#ifndef QT_NO_DEBUG
129 if (lcQsgLeak().isDebugEnabled()) {
131 if (qt_material_count < 0)
132 qCDebug(lcQsgLeak, "Material destroyed after qt_print_material_count() was called.");
133 }
134#endif
135}
136
137
138
186{
187 if (on)
188 m_flags |= flags;
189 else
190 m_flags &= ~flags;
191}
192
193
194
209{
210 Q_ASSERT(other && type() == other->type());
211 const qintptr diff = qintptr(this) - qintptr(other);
212 return diff < 0 ? -1 : (diff > 0 ? 1 : 0);
213}
214
215
216
425{
426 if (m_flags.testFlag(MultiView4))
427 return 4;
428 if (m_flags.testFlag(MultiView3))
429 return 3;
430 if (m_flags.testFlag(MultiView2))
431 return 2;
432 return 1;
433}
434
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:44
int viewCount() const
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 qCDebug(category,...)
#define Q_DECLARE_LOGGING_CATEGORY(name)
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
#define Q_UNUSED(x)
ptrdiff_t qintptr
Definition qtypes.h:166
QSharedPointer< T > other(t)
[5]