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
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
26{
28 const QSSGShaderFeatures m_featuresOrig;
32
33 void detach()
34 {
35 if (m_materialKeyOrig) {
36 m_materialKeyCopy = *m_materialKeyOrig;
37 m_materialKeyOrig = nullptr;
38 }
39 }
40
41 QSSGShaderMapKey(const QByteArray &inName,
42 const QSSGShaderFeatures &inFeatures,
43 const QSSGShaderDefaultMaterialKey &inMaterialKey)
45 {
46 m_hashCode = qHash(m_name) ^ qHash(m_featuresOrig) ^ qHash(m_materialKeyOrig->hash());
47 }
48};
49
50inline bool operator==(const QSSGShaderMapKey &a, const QSSGShaderMapKey &b) Q_DECL_NOTHROW
51{
52 if (a.m_name != b.m_name)
53 return false;
54
55 const QSSGShaderDefaultMaterialKey *keyA = a.m_materialKeyOrig ? a.m_materialKeyOrig : &a.m_materialKeyCopy;
56 const QSSGShaderDefaultMaterialKey *keyB = b.m_materialKeyOrig ? b.m_materialKeyOrig : &b.m_materialKeyCopy;
57 if (!(*keyA == *keyB))
58 return false;
59
60 return (a.m_featuresOrig == b.m_featuresOrig);
61}
62
63inline size_t qHash(const QSSGShaderMapKey &key, size_t seed)
64{
65 return key.m_hashCode ^ seed;
66}
67
68QT_END_NAMESPACE
69
70#endif
friend class QSSGRenderContextInterface
static void cleanupResourcesImpl(const QSSGRenderContextInterface &rci, const Container &resources)
static void dfs(const QSSGRenderNode &node, RenderableList &renderables)
static QByteArray logPrefix()
QSSGShaderDefaultMaterialKey m_materialKeyCopy
const QSSGShaderFeatures m_featuresOrig
const QSSGShaderDefaultMaterialKey * m_materialKeyOrig
QSSGShaderMapKey(const QByteArray &inName, const QSSGShaderFeatures &inFeatures, const QSSGShaderDefaultMaterialKey &inMaterialKey)