| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ui/gl/gl_fence_arb.h" | 5 #include "ui/gl/gl_fence_arb.h" |
| 6 | 6 |
| 7 #include "ui/gl/gl_bindings.h" | 7 #include "ui/gl/gl_bindings.h" |
| 8 #include "ui/gl/gl_context.h" | 8 #include "ui/gl/gl_context.h" |
| 9 | 9 |
| 10 namespace gfx { | 10 namespace gfx { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 | 26 |
| 27 DCHECK_EQ(GL_TRUE, glIsSync(sync_)); | 27 DCHECK_EQ(GL_TRUE, glIsSync(sync_)); |
| 28 // We could potentially use glGetSynciv here, but it doesn't work | 28 // We could potentially use glGetSynciv here, but it doesn't work |
| 29 // on OSX 10.7 (always says the fence is not signaled yet). | 29 // on OSX 10.7 (always says the fence is not signaled yet). |
| 30 // glClientWaitSync works better, so let's use that instead. | 30 // glClientWaitSync works better, so let's use that instead. |
| 31 return glClientWaitSync(sync_, 0, 0) != GL_TIMEOUT_EXPIRED; | 31 return glClientWaitSync(sync_, 0, 0) != GL_TIMEOUT_EXPIRED; |
| 32 } | 32 } |
| 33 | 33 |
| 34 void GLFenceARB::ClientWait() { | 34 void GLFenceARB::ClientWait() { |
| 35 DCHECK_EQ(GL_TRUE, glIsSync(sync_)); | 35 DCHECK_EQ(GL_TRUE, glIsSync(sync_)); |
| 36 if (!flush_event_ || flush_event_->IsSignaled()) { | 36 if (!flush_event_.get() || flush_event_->IsSignaled()) { |
| 37 glClientWaitSync(sync_, GL_SYNC_FLUSH_COMMANDS_BIT, GL_TIMEOUT_IGNORED); | 37 glClientWaitSync(sync_, GL_SYNC_FLUSH_COMMANDS_BIT, GL_TIMEOUT_IGNORED); |
| 38 } else { | 38 } else { |
| 39 LOG(ERROR) << "Trying to wait for uncommitted fence. Skipping..."; | 39 LOG(ERROR) << "Trying to wait for uncommitted fence. Skipping..."; |
| 40 } | 40 } |
| 41 } | 41 } |
| 42 | 42 |
| 43 void GLFenceARB::ServerWait() { | 43 void GLFenceARB::ServerWait() { |
| 44 DCHECK_EQ(GL_TRUE, glIsSync(sync_)); | 44 DCHECK_EQ(GL_TRUE, glIsSync(sync_)); |
| 45 if (!flush_event_ || flush_event_->IsSignaled()) { | 45 if (!flush_event_.get() || flush_event_->IsSignaled()) { |
| 46 glWaitSync(sync_, 0, GL_TIMEOUT_IGNORED); | 46 glWaitSync(sync_, 0, GL_TIMEOUT_IGNORED); |
| 47 } else { | 47 } else { |
| 48 LOG(ERROR) << "Trying to wait for uncommitted fence. Skipping..."; | 48 LOG(ERROR) << "Trying to wait for uncommitted fence. Skipping..."; |
| 49 } | 49 } |
| 50 } | 50 } |
| 51 | 51 |
| 52 GLFenceARB::~GLFenceARB() { | 52 GLFenceARB::~GLFenceARB() { |
| 53 DCHECK_EQ(GL_TRUE, glIsSync(sync_)); | 53 DCHECK_EQ(GL_TRUE, glIsSync(sync_)); |
| 54 glDeleteSync(sync_); | 54 glDeleteSync(sync_); |
| 55 } | 55 } |
| 56 | 56 |
| 57 } // namespace gfx | 57 } // namespace gfx |
| OLD | NEW |