Bug 1887335 - ClientWaitSync warns when forgetting to flush. r=gfx-reviewers,lsalzman

Differential Revision: https://phabricator.services.mozilla.com/D206296
This commit is contained in:
Kelsey Gilbert
2024-04-02 20:36:26 +00:00
parent 4a79a6f495
commit 3590c64ad0
2 changed files with 13 additions and 0 deletions

View File

@@ -5512,6 +5512,18 @@ GLenum ClientWebGLContext::ClientWaitSync(WebGLSyncJS& sync,
}
if (flags & LOCAL_GL_SYNC_FLUSH_COMMANDS_BIT) {
Flush();
} else {
constexpr uint8_t WARN_AT = 100;
if (sync.mNumQueriesWithoutFlushCommandsBit <= WARN_AT) {
sync.mNumQueriesWithoutFlushCommandsBit += 1;
if (sync.mNumQueriesWithoutFlushCommandsBit == WARN_AT) {
EnqueueWarning(
"ClientWaitSync with timeout=0 (or GetSyncParameter(SYNC_STATUS)) "
"called %hhu times without SYNC_FLUSH_COMMANDS_BIT. If you do not "
"flush, this sync object is not guaranteed to ever complete.",
sync.mNumQueriesWithoutFlushCommandsBit);
}
}
}
if (!timeout) return LOCAL_GL_TIMEOUT_EXPIRED;