Skip to content

Commit db07a86

Browse files
committed
Dummy commit to put in the Iterator for command segment list. DOES NOT COMPILE.
1 parent 8fbc870 commit db07a86

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

include/nbl/video/IGPUCommandPool.h

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,32 @@ class NBL_API IGPUCommandPool : public core::IReferenceCounted, public IBackendO
255255
CCommandSegment* tail = nullptr;
256256
};
257257

258+
struct Iterator
259+
{
260+
ICommand* cmd = nullptr;
261+
CCommandSegment* segment = nullptr;
262+
263+
inline bool operator!=(const Iterator& other) const { return cmd != other.cmd; }
264+
265+
inline Iterator operator++(int)
266+
{
267+
Iterator old = *this;
268+
if (cmd)
269+
{
270+
assert(segment);
271+
272+
// If `cmd` was "one past the end" then the size was wiped to 0 and it won't move.
273+
cmd = reinterpret_cast<ICommand*>(reinterpret_cast<uint8_t*>(cmd) + cmd->getSize());
274+
275+
if (cmd == segment->segment_end())
276+
*this = segment->end();
277+
}
278+
return old;
279+
}
280+
281+
inline ICommand* operator*() { return cmd; }
282+
};
283+
258284
CCommandSegmentListPool() : m_pool(COMMAND_SEGMENTS_PER_BLOCK*COMMAND_SEGMENT_SIZE, 0u, MAX_COMMAND_SEGMENT_BLOCK_COUNT, MIN_POOL_ALLOC_SIZE) {}
259285

260286
template <typename Cmd, typename... Args>

0 commit comments

Comments
 (0)