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:
@@ -5512,6 +5512,18 @@ GLenum ClientWebGLContext::ClientWaitSync(WebGLSyncJS& sync,
|
|||||||
}
|
}
|
||||||
if (flags & LOCAL_GL_SYNC_FLUSH_COMMANDS_BIT) {
|
if (flags & LOCAL_GL_SYNC_FLUSH_COMMANDS_BIT) {
|
||||||
Flush();
|
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;
|
if (!timeout) return LOCAL_GL_TIMEOUT_EXPIRED;
|
||||||
|
|
||||||
|
|||||||
@@ -490,6 +490,7 @@ class WebGLSyncJS final : public nsWrapperCache,
|
|||||||
|
|
||||||
bool mCanBeAvailable = false;
|
bool mCanBeAvailable = false;
|
||||||
uint8_t mNumQueriesBeforeFirstFrameBoundary = 0;
|
uint8_t mNumQueriesBeforeFirstFrameBoundary = 0;
|
||||||
|
uint8_t mNumQueriesWithoutFlushCommandsBit = 0;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(WebGLSyncJS)
|
NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(WebGLSyncJS)
|
||||||
|
|||||||
Reference in New Issue
Block a user