Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(935)

Unified Diff: ui/gl/gl_fence_arb.cc

Issue 2408543003: Loosen the GLFenceARB assertions when glClientWaitSync fails. (Closed)
Patch Set: Preemptive rebase. Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/gl/gl_fence_arb.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gl/gl_fence_arb.cc
diff --git a/ui/gl/gl_fence_arb.cc b/ui/gl/gl_fence_arb.cc
index a1ade666565bc620333af6114400fdd3b1486971..8f1711f00ecf321dfdedda66ef4838c532323494 100644
--- a/ui/gl/gl_fence_arb.cc
+++ b/ui/gl/gl_fence_arb.cc
@@ -6,6 +6,7 @@
#include "base/strings/stringprintf.h"
#include "ui/gl/gl_bindings.h"
+#include "ui/gl/gl_context.h"
namespace gl {
@@ -40,7 +41,8 @@ bool GLFenceARB::HasCompleted() {
// glClientWaitSync works better, so let's use that instead.
GLenum result = glClientWaitSync(sync_, 0, 0);
if (result == GL_WAIT_FAILED) {
- LOG(FATAL) << "Failed to wait for GLFence. error code:" << GetGLErrors();
+ HandleClientWaitFailure();
+ return false;
}
return result != GL_TIMEOUT_EXPIRED;
}
@@ -51,7 +53,7 @@ void GLFenceARB::ClientWait() {
glClientWaitSync(sync_, GL_SYNC_FLUSH_COMMANDS_BIT, GL_TIMEOUT_IGNORED);
DCHECK_NE(static_cast<GLenum>(GL_TIMEOUT_EXPIRED), result);
if (result == GL_WAIT_FAILED) {
- LOG(FATAL) << "Failed to wait for GLFence. error code:" << GetGLErrors();
+ HandleClientWaitFailure();
}
}
@@ -71,4 +73,23 @@ void GLFenceARB::Invalidate() {
sync_ = 0;
}
+void GLFenceARB::HandleClientWaitFailure() {
+ DCHECK(GLContext::GetCurrent());
+ if (GLContext::GetCurrent()->WasAllocatedUsingRobustnessExtension()) {
+ // This function pointer is only set if one of the robustness
+ // extensions was available.
+ DCHECK(g_driver_gl.fn.glGetGraphicsResetStatusARBFn);
+ DCHECK(g_driver_gl.fn.glGetGraphicsResetStatusARBFn() != GL_NO_ERROR);
+ LOG(ERROR) << "Failed to wait for GLFence; context was lost. Error code: "
+ << GetGLErrors();
+ } else {
+ // There's no provision for reporting these failures higher up the
+ // stack and thereby losing the context (or exiting the GPU
+ // process) more cooperatively. Some of this code is called from
+ // deep call stacks. Report the wait failure and crash with a log
+ // message.
+ LOG(FATAL) << "Failed to wait for GLFence. Error code: " << GetGLErrors();
+ }
+}
+
} // namespace gl
« no previous file with comments | « ui/gl/gl_fence_arb.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698