Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
qssgshadermapkey_p.h
Go to the documentation of this file.
1// Copyright (C) 2008-2012 NVIDIA Corporation.
2// Copyright (C) 2019 The Qt Company Ltd.
3// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
4
5#ifndef QSSGSHADERMAPKEY_P_H
6#define QSSGSHADERMAPKEY_P_H
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is not part of the Qt API. It exists purely as an
13// implementation detail. This header file may change from version to
14// version without notice, or even be removed.
15//
16// We mean it.
17//
18
19#include <QtQuick3DRuntimeRender/private/qtquick3druntimerenderglobal_p.h>
20#include <QtQuick3DRuntimeRender/private/qssgrendershaderkeys_p.h>
21#include <QtQuick3DRuntimeRender/private/qssgrendershadercache_p.h>
22
24{
30 size_t m_hashCode;
31
32 void detach()
33 {
34 if (m_featuresOrig) {
36 m_featuresOrig = nullptr;
37 }
40 m_materialKeyOrig = nullptr;
41 }
42 }
43
45 const QSSGShaderFeatures &inFeatures,
46 const QSSGShaderDefaultMaterialKey &inMaterialKey)
47 : m_name(inName), m_featuresOrig(&inFeatures), m_materialKeyOrig(&inMaterialKey)
48 {
50 }
51};
52
54{
55 if (a.m_name != b.m_name)
56 return false;
57
58 const QSSGShaderDefaultMaterialKey *keyA = a.m_materialKeyOrig ? a.m_materialKeyOrig : &a.m_materialKeyCopy;
59 const QSSGShaderDefaultMaterialKey *keyB = b.m_materialKeyOrig ? b.m_materialKeyOrig : &b.m_materialKeyCopy;
60 if (!(*keyA == *keyB))
61 return false;
62
63 const QSSGShaderFeatures *featuresA = a.m_featuresOrig ? a.m_featuresOrig : &a.m_featuresCopy;
64 const QSSGShaderFeatures *featuresB = b.m_featuresOrig ? b.m_featuresOrig : &b.m_featuresCopy;
65 return *featuresA == *featuresB;
66}
67
68inline size_t qHash(const QSSGShaderMapKey &key, size_t seed)
69{
70 return key.m_hashCode ^ seed;
71}
72
73#endif
\inmodule QtCore
Definition qbytearray.h:57
#define Q_DECL_NOTHROW
GLboolean GLboolean GLboolean b
GLuint64 key
GLboolean GLboolean GLboolean GLboolean a
[7]
static Q_CONSTINIT QBasicAtomicInteger< unsigned > seed
Definition qrandom.cpp:196
size_t qHash(const QSSGShaderMapKey &key, size_t seed)
bool operator==(const QSSGShaderMapKey &a, const QSSGShaderMapKey &b) Q_DECL_NOTHROW
QSSGShaderDefaultMaterialKey m_materialKeyCopy
const QSSGShaderDefaultMaterialKey * m_materialKeyOrig
QSSGShaderFeatures m_featuresCopy
const QSSGShaderFeatures * m_featuresOrig
QSSGShaderMapKey(const QByteArray &inName, const QSSGShaderFeatures &inFeatures, const QSSGShaderDefaultMaterialKey &inMaterialKey)