| Index: trunk/src/ui/gl/gl_fence.cc
|
| ===================================================================
|
| --- trunk/src/ui/gl/gl_fence.cc (revision 258964)
|
| +++ trunk/src/ui/gl/gl_fence.cc (working copy)
|
| @@ -25,11 +25,8 @@
|
| // We will arbitrarily return TRUE for consistency.
|
| glGenFencesNV(1, &fence_);
|
| glSetFenceNV(fence_, GL_ALL_COMPLETED_NV);
|
| - if (flush) {
|
| + if (flush)
|
| glFlush();
|
| - } else {
|
| - flush_event_ = gfx::GLContext::GetCurrent()->SignalFlush();
|
| - }
|
| }
|
|
|
| virtual bool HasCompleted() OVERRIDE {
|
| @@ -37,15 +34,11 @@
|
| }
|
|
|
| virtual void ClientWait() OVERRIDE {
|
| - if (!flush_event_ || flush_event_->IsSignaled()) {
|
| - glFinishFenceNV(fence_);
|
| - } else {
|
| - LOG(ERROR) << "Trying to wait for uncommitted fence. Skipping...";
|
| - }
|
| + glFinishFenceNV(fence_);
|
| }
|
|
|
| virtual void ServerWait() OVERRIDE {
|
| - ClientWait();
|
| + glFinishFenceNV(fence_);
|
| }
|
|
|
| private:
|
| @@ -54,18 +47,14 @@
|
| }
|
|
|
| GLuint fence_;
|
| - scoped_refptr<gfx::GLContext::FlushEvent> flush_event_;
|
| };
|
|
|
| class GLFenceARBSync: public gfx::GLFence {
|
| public:
|
| GLFenceARBSync(bool flush) {
|
| sync_ = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
|
| - if (flush) {
|
| + if (flush)
|
| glFlush();
|
| - } else {
|
| - flush_event_ = gfx::GLContext::GetCurrent()->SignalFlush();
|
| - }
|
| }
|
|
|
| virtual bool HasCompleted() OVERRIDE {
|
| @@ -80,19 +69,11 @@
|
| }
|
|
|
| virtual void ClientWait() OVERRIDE {
|
| - if (!flush_event_ || flush_event_->IsSignaled()) {
|
| - glClientWaitSync(sync_, GL_SYNC_FLUSH_COMMANDS_BIT, GL_TIMEOUT_IGNORED);
|
| - } else {
|
| - LOG(ERROR) << "Trying to wait for uncommitted fence. Skipping...";
|
| - }
|
| + glClientWaitSync(sync_, GL_SYNC_FLUSH_COMMANDS_BIT, GL_TIMEOUT_IGNORED);
|
| }
|
|
|
| virtual void ServerWait() OVERRIDE {
|
| - if (!flush_event_ || flush_event_->IsSignaled()) {
|
| - glWaitSync(sync_, 0, GL_TIMEOUT_IGNORED);
|
| - } else {
|
| - LOG(ERROR) << "Trying to wait for uncommitted fence. Skipping...";
|
| - }
|
| + glWaitSync(sync_, 0, GL_TIMEOUT_IGNORED);
|
| }
|
|
|
| private:
|
| @@ -101,7 +82,6 @@
|
| }
|
|
|
| GLsync sync_;
|
| - scoped_refptr<gfx::GLContext::FlushEvent> flush_event_;
|
| };
|
|
|
| #if !defined(OS_MACOSX)
|
| @@ -110,11 +90,8 @@
|
| EGLFenceSync(bool flush) {
|
| display_ = eglGetCurrentDisplay();
|
| sync_ = eglCreateSyncKHR(display_, EGL_SYNC_FENCE_KHR, NULL);
|
| - if (flush) {
|
| + if (flush)
|
| glFlush();
|
| - } else {
|
| - flush_event_ = gfx::GLContext::GetCurrent()->SignalFlush();
|
| - }
|
| }
|
|
|
| virtual bool HasCompleted() OVERRIDE {
|
| @@ -125,22 +102,14 @@
|
| }
|
|
|
| virtual void ClientWait() OVERRIDE {
|
| - if (!flush_event_ || flush_event_->IsSignaled()) {
|
| - EGLint flags = 0;
|
| - EGLTimeKHR time = EGL_FOREVER_KHR;
|
| - eglClientWaitSyncKHR(display_, sync_, flags, time);
|
| - } else {
|
| - LOG(ERROR) << "Trying to wait for uncommitted fence. Skipping...";
|
| - }
|
| + EGLint flags = 0;
|
| + EGLTimeKHR time = EGL_FOREVER_KHR;
|
| + eglClientWaitSyncKHR(display_, sync_, flags, time);
|
| }
|
|
|
| virtual void ServerWait() OVERRIDE {
|
| - if (!flush_event_ || flush_event_->IsSignaled()) {
|
| - EGLint flags = 0;
|
| - eglWaitSyncKHR(display_, sync_, flags);
|
| - } else {
|
| - LOG(ERROR) << "Trying to wait for uncommitted fence. Skipping...";
|
| - }
|
| + EGLint flags = 0;
|
| + eglWaitSyncKHR(display_, sync_, flags);
|
| }
|
|
|
|
|
| @@ -151,15 +120,11 @@
|
|
|
| EGLSyncKHR sync_;
|
| EGLDisplay display_;
|
| - scoped_refptr<gfx::GLContext::FlushEvent> flush_event_;
|
| };
|
| #endif // !OS_MACOSX
|
|
|
| // static
|
| gfx::GLFence* CreateFence(bool flush) {
|
| - DCHECK(gfx::GLContext::GetCurrent())
|
| - << "Trying to create fence with no context";
|
| -
|
| #if !defined(OS_MACOSX)
|
| if (gfx::g_driver_egl.ext.b_EGL_KHR_fence_sync)
|
| return new EGLFenceSync(flush);
|
|
|