Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
Loading...
Searching...
No Matches
qssgrenderparticleshaderkeys_p.h
Go to the documentation of this file.
1
// Copyright (C) 2025 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
// Qt-Security score:significant reason:default
4
5
6
#
ifndef
QSSG_RENDER_PARTICLE_SHADER_KEY_H
7
#
define
QSSG_RENDER_PARTICLE_SHADER_KEY_H
8
9
//
10
// W A R N I N G
11
// -------------
12
//
13
// This file is not part of the Qt API. It exists purely as an
14
// implementation detail. This header file may change from version to
15
// version without notice, or even be removed.
16
//
17
// We mean it.
18
//
19
20
#
include
"qssgrendershaderkeys_p.h"
21
22
QT_BEGIN_NAMESPACE
23
24
struct
QSSGShaderParticleMaterialKeyProperties
25
{
26
qsizetype
m_stringBufferSizeHint
= 0;
27
QSSGShaderKeyBoolean
m_isSpriteLinear
;
28
QSSGShaderKeyBoolean
m_isColorTableLinear
;
29
QSSGShaderKeyBoolean
m_hasLighting
;
30
QSSGShaderKeyBoolean
m_isLineParticle
;
31
QSSGShaderKeyBoolean
m_isMapped
;
32
QSSGShaderKeyBoolean
m_isAnimated
;
33
QSSGShaderKeyBoolean
m_oitMSAA
;
34
QSSGShaderKeyUnsigned
<3>
m_viewCount
;
35
QSSGShaderKeyUnsigned
<3>
m_orderIndependentTransparency
;
36
37
QSSGShaderParticleMaterialKeyProperties
()
38
:
m_isSpriteLinear
(
"isSpriteLinear"
)
39
,
m_isColorTableLinear
(
"isColorTableLinear"
)
40
,
m_hasLighting
(
"hasLighting"
)
41
,
m_isLineParticle
(
"isLineParticle"
)
42
,
m_isMapped
(
"isMapped"
)
43
,
m_isAnimated
(
"isAnimated"
)
44
,
m_oitMSAA
(
"oitMSAA"
)
45
,
m_viewCount
(
"viewCount"
)
46
,
m_orderIndependentTransparency
(
"orderIndependentTransparency"
)
47
{
48
init
(
)
;
49
}
50
51
template
<
typename
TVisitor>
52
void
visitProperties
(TVisitor &inVisitor)
53
{
54
inVisitor.visit(m_isSpriteLinear);
55
inVisitor.visit(m_isColorTableLinear);
56
inVisitor.visit(m_hasLighting);
57
inVisitor.visit(m_isLineParticle);
58
inVisitor.visit(m_isMapped);
59
inVisitor.visit(m_isAnimated);
60
inVisitor.visit(m_oitMSAA);
61
inVisitor.visit(m_viewCount);
62
inVisitor.visit(m_orderIndependentTransparency);
63
}
64
65
struct
OffsetVisitor
66
{
67
quint32
m_offset
;
68
OffsetVisitor
() :
m_offset
(0) {}
69
template
<
typename
TPropType>
70
void
visit
(TPropType &inProp)
71
{
72
// if we cross the 32 bit border we just move
73
// to the next dword.
74
// This cost a few extra bits but prevents tedious errors like
75
// loosing shader key bits because they got moved beyond the 32 border
76
quint32 bit = m_offset % 32;
77
if
(bit + TPropType::BitWidth > 32) {
78
m_offset += 32 - bit;
79
}
80
81
inProp.setOffset(m_offset);
82
m_offset += TPropType::BitWidth;
83
}
84
};
85
86
struct
StringSizeVisitor
87
{
88
qsizetype
size
= 0;
89
template
<
typename
P>
90
constexpr
void
visit
(
const
P &prop)
91
{
92
size += prop.name.size();
93
}
94
};
95
96
struct
InitVisitor
97
{
98
OffsetVisitor
offsetVisitor
;
99
StringSizeVisitor
stringSizeVisitor
;
100
101
template
<
typename
P>
102
void
visit
(P &prop)
103
{
104
offsetVisitor.visit(prop);
105
stringSizeVisitor.visit(prop);
106
}
107
};
108
109
void
init
()
110
{
111
InitVisitor
visitor;
112
visitProperties(visitor);
113
114
// If this assert fires, then the material key needs more bits.
115
Q_ASSERT(visitor.offsetVisitor.m_offset < 32);
116
// This is so we can do some guestimate of how big the string buffer needs
117
// to be to avoid doing a lot of allocations when concatenating the strings.
118
m_stringBufferSizeHint = visitor.stringSizeVisitor.size;
119
}
120
};
121
122
typedef
QSSGShaderBaseMaterialKey
<
QSSGShaderParticleMaterialKeyProperties
, 1>
QSSGShaderParticleMaterialKey
;
123
124
Q_STATIC_ASSERT(std::is_trivially_destructible<QSSGShaderParticleMaterialKey>::value);
125
126
inline
size_t
qHash
(
const
QSSGShaderParticleMaterialKey
&key)
127
{
128
return
key.hash();
129
}
130
131
QT_END_NAMESPACE
132
133
#
endif
QT_BEGIN_NAMESPACE
Combined button and popup list for selecting options.
Definition
qsequentialanimationgroup.cpp:47
QSSGShaderParticleMaterialKey
QSSGShaderBaseMaterialKey< QSSGShaderParticleMaterialKeyProperties, 1 > QSSGShaderParticleMaterialKey
Definition
qssgrenderparticleshaderkeys_p.h:122
qHash
size_t qHash(const QSSGShaderParticleMaterialKey &key)
Definition
qssgrenderparticleshaderkeys_p.h:126
QSSGShaderBaseMaterialKey
Definition
qssgrendershaderkeys_p.h:1004
QSSGShaderKeyBoolean
Definition
qssgrendershaderkeys_p.h:86
QSSGShaderKeyUnsigned
Definition
qssgrendershaderkeys_p.h:130
QSSGShaderParticleMaterialKeyProperties::InitVisitor
Definition
qssgrenderparticleshaderkeys_p.h:97
QSSGShaderParticleMaterialKeyProperties::InitVisitor::offsetVisitor
OffsetVisitor offsetVisitor
Definition
qssgrenderparticleshaderkeys_p.h:98
QSSGShaderParticleMaterialKeyProperties::InitVisitor::visit
void visit(P &prop)
Definition
qssgrenderparticleshaderkeys_p.h:102
QSSGShaderParticleMaterialKeyProperties::InitVisitor::stringSizeVisitor
StringSizeVisitor stringSizeVisitor
Definition
qssgrenderparticleshaderkeys_p.h:99
QSSGShaderParticleMaterialKeyProperties::OffsetVisitor
Definition
qssgrenderparticleshaderkeys_p.h:66
QSSGShaderParticleMaterialKeyProperties::OffsetVisitor::visit
void visit(TPropType &inProp)
Definition
qssgrenderparticleshaderkeys_p.h:70
QSSGShaderParticleMaterialKeyProperties::OffsetVisitor::m_offset
quint32 m_offset
Definition
qssgrenderparticleshaderkeys_p.h:67
QSSGShaderParticleMaterialKeyProperties::OffsetVisitor::OffsetVisitor
OffsetVisitor()
Definition
qssgrenderparticleshaderkeys_p.h:68
QSSGShaderParticleMaterialKeyProperties::StringSizeVisitor
Definition
qssgrenderparticleshaderkeys_p.h:87
QSSGShaderParticleMaterialKeyProperties::StringSizeVisitor::visit
constexpr void visit(const P &prop)
Definition
qssgrenderparticleshaderkeys_p.h:90
QSSGShaderParticleMaterialKeyProperties::StringSizeVisitor::size
qsizetype size
Definition
qssgrenderparticleshaderkeys_p.h:88
QSSGShaderParticleMaterialKeyProperties
Definition
qssgrenderparticleshaderkeys_p.h:25
QSSGShaderParticleMaterialKeyProperties::m_isMapped
QSSGShaderKeyBoolean m_isMapped
Definition
qssgrenderparticleshaderkeys_p.h:31
QSSGShaderParticleMaterialKeyProperties::m_isAnimated
QSSGShaderKeyBoolean m_isAnimated
Definition
qssgrenderparticleshaderkeys_p.h:32
QSSGShaderParticleMaterialKeyProperties::m_orderIndependentTransparency
QSSGShaderKeyUnsigned< 3 > m_orderIndependentTransparency
Definition
qssgrenderparticleshaderkeys_p.h:35
QSSGShaderParticleMaterialKeyProperties::visitProperties
void visitProperties(TVisitor &inVisitor)
Definition
qssgrenderparticleshaderkeys_p.h:52
QSSGShaderParticleMaterialKeyProperties::m_stringBufferSizeHint
qsizetype m_stringBufferSizeHint
Definition
qssgrenderparticleshaderkeys_p.h:26
QSSGShaderParticleMaterialKeyProperties::m_viewCount
QSSGShaderKeyUnsigned< 3 > m_viewCount
Definition
qssgrenderparticleshaderkeys_p.h:34
QSSGShaderParticleMaterialKeyProperties::init
void init()
Definition
qssgrenderparticleshaderkeys_p.h:109
QSSGShaderParticleMaterialKeyProperties::QSSGShaderParticleMaterialKeyProperties
QSSGShaderParticleMaterialKeyProperties()
Definition
qssgrenderparticleshaderkeys_p.h:37
QSSGShaderParticleMaterialKeyProperties::m_isLineParticle
QSSGShaderKeyBoolean m_isLineParticle
Definition
qssgrenderparticleshaderkeys_p.h:30
QSSGShaderParticleMaterialKeyProperties::m_hasLighting
QSSGShaderKeyBoolean m_hasLighting
Definition
qssgrenderparticleshaderkeys_p.h:29
QSSGShaderParticleMaterialKeyProperties::m_oitMSAA
QSSGShaderKeyBoolean m_oitMSAA
Definition
qssgrenderparticleshaderkeys_p.h:33
QSSGShaderParticleMaterialKeyProperties::m_isSpriteLinear
QSSGShaderKeyBoolean m_isSpriteLinear
Definition
qssgrenderparticleshaderkeys_p.h:27
QSSGShaderParticleMaterialKeyProperties::m_isColorTableLinear
QSSGShaderKeyBoolean m_isColorTableLinear
Definition
qssgrenderparticleshaderkeys_p.h:28
qtquick3d
src
runtimerender
qssgrenderparticleshaderkeys_p.h
Generated on
for Qt by
1.18.0