Divide Framework 0.1
A free and open-source 3D Framework under heavy development
Loading...
Searching...
No Matches
BufferLocks.cpp
Go to the documentation of this file.
1
2
5
6namespace Divide {
7
8 [[nodiscard]] bool IsEmpty(const BufferLocks& locks) noexcept {
9 if (locks.empty())
10 {
11 return true;
12 }
13
14 for (auto& it : locks) {
15 if ( it._type != BufferSyncUsage::COUNT &&
16 it._buffer != nullptr &&
17 it._range._length > 0u)
18 {
19 return false;
20 }
21 }
22
23 return true;
24 }
25
27 {
28 if ( _isLockable && range._length > 0u ) [[likely]]
29 {
30 DIVIDE_ASSERT( _lockManager != nullptr );
31
32 return _lockManager->lockRange( range._startOffset, range._length, sync );
33 }
34
35 return true;
36 }
37
39 {
40 if ( _isLockable && range._length > 0u ) [[likely]]
41 {
42 DIVIDE_ASSERT( _lockManager != nullptr );
43
44 return _lockManager->waitForLockedRange( range._startOffset, range._length );
45 }
46
47 return true;
48 }
49} //namespace Divide
#define DIVIDE_ASSERT(...)
Handle console commands that start with a forward slash.
Definition: AIProcessor.cpp:7
eastl::fixed_vector< BufferLock, 6, true > BufferLocks
Definition: BufferLocks.h:63
bool IsEmpty(const BufferLocks &locks) noexcept
Definition: BufferLocks.cpp:8
bool waitForLockedRange(BufferRange range) const
Definition: BufferLocks.cpp:38
bool lockRange(BufferRange range, SyncObjectHandle &sync) const
Definition: BufferLocks.cpp:26
LockManager_uptr _lockManager
Definition: BufferLocks.h:46