43 if (
entry._ptr ==
nullptr )
45 entry._ptr = std::make_unique<glSyncObject>(flag, frameIdx);
65 static bool Wait( gl46core::GLsync sync,
U8& retryCount )
69 gl46core::GLuint64 waitTimeout = 0u;
70 gl46core::SyncObjectMask waitFlags = gl46core::SyncObjectMask::GL_NONE_BIT;
76 const gl46core::GLenum waitRet = gl46core::glClientWaitSync( sync, waitFlags, waitTimeout );
77 if ( waitRet == gl46core::GL_ALREADY_SIGNALED || waitRet == gl46core::GL_CONDITION_SATISFIED )
81 DIVIDE_ASSERT( waitRet != gl46core::GL_WAIT_FAILED,
"glLockManager::wait error: Not sure what to do here. Probably raise an exception or something." );
83 if ( retryCount == 1 )
90 waitFlags = gl46core::SyncObjectMask::GL_SYNC_FLUSH_COMMANDS_BIT;
95 if ( waitRet != gl46core::GL_TIMEOUT_EXPIRED ) [[unlikely]]
#define PROFILE_SCOPE_AUTO(CATEGORY)
#define PROFILE_TAG(NAME,...)
#define PROFILE_SCOPE(NAME, CATEGORY)
static void DestroyFenceSync(gl46core::GLsync &sync)
static gl46core::GLsync CreateFenceSync()
static GLStateTracker & GetStateTracker() noexcept
static void QueueFlush() noexcept
virtual bool waitForLockedRangeLocked(const SyncObject_uptr &sync, const BufferRange &testRange, const BufferLockInstance &lock)
bool waitForLockedRange(size_t lockBeginBytes, size_t lockLength)
Returns false if we encountered an error.
static bool InitLockPoolEntry(BufferLockPoolEntry &entry, U8 flag, U64 frameIdx)
~glLockManager() override
bool waitForLockedRangeLocked(const SyncObject_uptr &sync, const BufferRange &testRange, const BufferLockInstance &lock) override
constexpr U8 MAX_FRAMES_IN_FLIGHT
Maximum number of active frames until we start waiting on a fence/sync.
constexpr Optick::Category::Type Graphics
Handle console commands that start with a forward slash.
constexpr U8 g_MaxLockWaitRetries
void Wait(const Task &task, TaskPool &pool)
constexpr gl46core::GLuint64 kOneSecondInNanoSeconds
Project const SceneEntry & entry
static NO_INLINE void errorfn(const char *format, T &&... args)
U64 _lastSyncedFrameNumber
static constexpr U64 INVALID_FRAME_NUMBER
gl46core::GLsync _syncObject
glSyncObject(U8 flag, U64 frameIdx)