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

Unified Diff: ui/gl/gl_fence_arb.cc

Issue 706203003: Update from https://crrev.com/303153 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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_context_egl.cc ('k') | ui/gl/gl_fence_egl.cc » ('j') | 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 da13f107880d8ae0c996218af9d75fad46470932..05bda6b588f2eb219ae2abfcda444070a7a469cf 100644
--- a/ui/gl/gl_fence_arb.cc
+++ b/ui/gl/gl_fence_arb.cc
@@ -4,11 +4,26 @@
#include "ui/gl/gl_fence_arb.h"
+#include "base/strings/stringprintf.h"
#include "ui/gl/gl_bindings.h"
#include "ui/gl/gl_context.h"
namespace gfx {
+namespace {
+
+std::string GetGLErrors() {
+ // Clears and logs all current gl errors.
+ std::string accumulated_errors;
+ GLenum error;
+ while ((error = glGetError()) != GL_NO_ERROR) {
+ accumulated_errors += base::StringPrintf("0x%x ", error);
+ }
+ return accumulated_errors;
+}
+
+} // namespace
+
GLFenceARB::GLFenceARB(bool flush) {
sync_ = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
DCHECK_EQ(GL_TRUE, glIsSync(sync_));
@@ -28,13 +43,22 @@ bool GLFenceARB::HasCompleted() {
// We could potentially use glGetSynciv here, but it doesn't work
// on OSX 10.7 (always says the fence is not signaled yet).
// glClientWaitSync works better, so let's use that instead.
- return glClientWaitSync(sync_, 0, 0) != GL_TIMEOUT_EXPIRED;
+ GLenum result = glClientWaitSync(sync_, 0, 0);
+ if (result == GL_WAIT_FAILED) {
+ LOG(FATAL) << "Failed to wait for GLFence. error code:" << GetGLErrors();
+ }
+ return result != GL_TIMEOUT_EXPIRED;
}
void GLFenceARB::ClientWait() {
DCHECK_EQ(GL_TRUE, glIsSync(sync_));
if (!flush_event_.get() || flush_event_->IsSignaled()) {
- glClientWaitSync(sync_, GL_SYNC_FLUSH_COMMANDS_BIT, GL_TIMEOUT_IGNORED);
+ GLenum result =
+ 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();
+ }
} else {
LOG(ERROR) << "Trying to wait for uncommitted fence. Skipping...";
}
« no previous file with comments | « ui/gl/gl_context_egl.cc ('k') | ui/gl/gl_fence_egl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698