3
3
namespace nbl ::asset
4
4
{
5
5
6
- constexpr static int32_t findLSB (size_t val)
7
- {
8
- if constexpr (std::is_constant_evaluated ())
9
- {
10
- for (size_t ix=0ull ; ix<sizeof (size_t )*8 ; ix++)
11
- if ((0x1ull << ix) & val) return ix;
12
- return ~0u ;
13
- } else
14
- {
15
- return hlsl::findLSB (val);
16
- }
17
- }
18
-
19
6
core::bitflag<PIPELINE_STAGE_FLAGS> allPreviousStages (core::bitflag<PIPELINE_STAGE_FLAGS> stages)
20
7
{
21
8
struct PerStagePreviousStages
@@ -49,7 +36,7 @@ core::bitflag<PIPELINE_STAGE_FLAGS> allPreviousStages(core::bitflag<PIPELINE_STA
49
36
50
37
constexpr void add (PIPELINE_STAGE_FLAGS stageFlag, PIPELINE_STAGE_FLAGS previousStageFlags)
51
38
{
52
- const auto bitIx = findLSB (static_cast <size_t >(stageFlag));
39
+ const auto bitIx = hlsl:: findLSB (static_cast <size_t >(stageFlag));
53
40
data[bitIx] |= previousStageFlags;
54
41
}
55
42
@@ -61,7 +48,7 @@ core::bitflag<PIPELINE_STAGE_FLAGS> allPreviousStages(core::bitflag<PIPELINE_STA
61
48
core::bitflag<PIPELINE_STAGE_FLAGS> retval = PIPELINE_STAGE_FLAGS::NONE;
62
49
while (bool (stages.value ))
63
50
{
64
- const auto bitIx = findLSB (static_cast <size_t >(stages.value ));
51
+ const auto bitIx = hlsl:: findLSB (static_cast <size_t >(stages.value ));
65
52
retval |= bitToAccess[bitIx];
66
53
stages ^= static_cast <PIPELINE_STAGE_FLAGS>(0x1u <<bitIx);
67
54
}
@@ -101,7 +88,7 @@ core::bitflag<PIPELINE_STAGE_FLAGS> allLaterStages(core::bitflag<PIPELINE_STAGE_
101
88
102
89
constexpr void add (PIPELINE_STAGE_FLAGS stageFlag, PIPELINE_STAGE_FLAGS laterStageFlags)
103
90
{
104
- const auto bitIx = findLSB (static_cast <size_t >(stageFlag));
91
+ const auto bitIx = hlsl:: findLSB (static_cast <size_t >(stageFlag));
105
92
data[bitIx] |= laterStageFlags;
106
93
}
107
94
@@ -113,7 +100,7 @@ core::bitflag<PIPELINE_STAGE_FLAGS> allLaterStages(core::bitflag<PIPELINE_STAGE_
113
100
core::bitflag<PIPELINE_STAGE_FLAGS> retval = PIPELINE_STAGE_FLAGS::NONE;
114
101
while (bool (stages.value ))
115
102
{
116
- const auto bitIx = findLSB (static_cast <size_t >(stages.value ));
103
+ const auto bitIx = hlsl:: findLSB (static_cast <size_t >(stages.value ));
117
104
retval |= bitToAccess[bitIx];
118
105
stages ^= static_cast <PIPELINE_STAGE_FLAGS>(0x1u <<bitIx);
119
106
}
@@ -179,7 +166,7 @@ core::bitflag<ACCESS_FLAGS> allAccessesFromStages(core::bitflag<PIPELINE_STAGE_F
179
166
180
167
constexpr void init (PIPELINE_STAGE_FLAGS stageFlag, ACCESS_FLAGS accessFlags)
181
168
{
182
- const auto bitIx = findLSB (static_cast <size_t >(stageFlag));
169
+ const auto bitIx = hlsl:: findLSB (static_cast <size_t >(stageFlag));
183
170
data[bitIx] = accessFlags;
184
171
}
185
172
@@ -193,7 +180,7 @@ core::bitflag<ACCESS_FLAGS> allAccessesFromStages(core::bitflag<PIPELINE_STAGE_F
193
180
core::bitflag<ACCESS_FLAGS> retval = ACCESS_FLAGS::NONE;
194
181
while (bool (stages.value ))
195
182
{
196
- const auto bitIx = findLSB (static_cast <size_t >(stages.value ));
183
+ const auto bitIx = hlsl:: findLSB (static_cast <size_t >(stages.value ));
197
184
retval |= bitToAccess[bitIx];
198
185
stages ^= static_cast <PIPELINE_STAGE_FLAGS>(0x1u <<bitIx);
199
186
}
@@ -259,7 +246,7 @@ core::bitflag<PIPELINE_STAGE_FLAGS> allStagesFromAccesses(core::bitflag<ACCESS_F
259
246
private:
260
247
constexpr void init (ACCESS_FLAGS accessFlags, PIPELINE_STAGE_FLAGS stageFlags)
261
248
{
262
- const auto bitIx = findLSB (static_cast <size_t >(accessFlags));
249
+ const auto bitIx = hlsl:: findLSB (static_cast <size_t >(accessFlags));
263
250
data[bitIx] = stageFlags;
264
251
}
265
252
@@ -270,7 +257,7 @@ core::bitflag<PIPELINE_STAGE_FLAGS> allStagesFromAccesses(core::bitflag<ACCESS_F
270
257
core::bitflag<PIPELINE_STAGE_FLAGS> retval = PIPELINE_STAGE_FLAGS::NONE;
271
258
while (bool (accesses.value ))
272
259
{
273
- const auto bitIx = findLSB (static_cast <size_t >(accesses.value ));
260
+ const auto bitIx = hlsl:: findLSB (static_cast <size_t >(accesses.value ));
274
261
retval |= bitToStage[bitIx];
275
262
accesses ^= static_cast <ACCESS_FLAGS>(0x1u <<bitIx);
276
263
}
0 commit comments