| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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.h" | 5 #include "ui/gl/gl_fence.h" |
| 6 | 6 |
| 7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
| 8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
| 9 #include "ui/gl/gl_bindings.h" | 9 #include "ui/gl/gl_bindings.h" |
| 10 #include "ui/gl/gl_context.h" | 10 #include "ui/gl/gl_context.h" |
| 11 #include "ui/gl/gl_fence_arb.h" | 11 #include "ui/gl/gl_fence_arb.h" |
| 12 #include "ui/gl/gl_fence_egl.h" | 12 #include "ui/gl/gl_fence_egl.h" |
| 13 #include "ui/gl/gl_fence_noop.h" |
| 13 #include "ui/gl/gl_fence_nv.h" | 14 #include "ui/gl/gl_fence_nv.h" |
| 14 #include "ui/gl/gl_gl_api_implementation.h" | 15 #include "ui/gl/gl_gl_api_implementation.h" |
| 15 #include "ui/gl/gl_implementation.h" | 16 #include "ui/gl/gl_implementation.h" |
| 16 #include "ui/gl/gl_version_info.h" | 17 #include "ui/gl/gl_version_info.h" |
| 17 | 18 |
| 18 #if defined(OS_MACOSX) | 19 #if defined(OS_MACOSX) |
| 19 #include "ui/gl/gl_fence_apple.h" | 20 #include "ui/gl/gl_fence_apple.h" |
| 20 #endif | 21 #endif |
| 21 | 22 |
| 22 namespace gfx { | 23 namespace gfx { |
| 23 | 24 |
| 24 GLFence::GLFence() { | 25 GLFence::GLFence() { |
| 25 } | 26 } |
| 26 | 27 |
| 27 GLFence::~GLFence() { | 28 GLFence::~GLFence() { |
| 28 } | 29 } |
| 29 | 30 |
| 30 bool GLFence::IsSupported() { | 31 bool GLFence::IsSupported() { |
| 31 DCHECK(GetGLVersionInfo()); | 32 DCHECK(GetGLVersionInfo()); |
| 32 return g_driver_gl.ext.b_GL_ARB_sync || GetGLVersionInfo()->is_es3 || | 33 return true || |
| 34 g_driver_gl.ext.b_GL_ARB_sync || GetGLVersionInfo()->is_es3 || |
| 33 GetGLImplementation() == kGLImplementationDesktopGLCoreProfile || | 35 GetGLImplementation() == kGLImplementationDesktopGLCoreProfile || |
| 34 #if defined(OS_MACOSX) | 36 #if defined(OS_MACOSX) |
| 35 g_driver_gl.ext.b_GL_APPLE_fence || | 37 g_driver_gl.ext.b_GL_APPLE_fence || |
| 36 #else | 38 #else |
| 37 g_driver_egl.ext.b_EGL_KHR_fence_sync || | 39 g_driver_egl.ext.b_EGL_KHR_fence_sync || |
| 38 #endif | 40 #endif |
| 39 g_driver_gl.ext.b_GL_NV_fence; | 41 g_driver_gl.ext.b_GL_NV_fence; |
| 40 } | 42 } |
| 41 | 43 |
| 42 GLFence* GLFence::Create() { | 44 GLFence* GLFence::Create() { |
| 43 DCHECK(GLContext::GetCurrent()) | 45 DCHECK(GLContext::GetCurrent()) |
| 44 << "Trying to create fence with no context"; | 46 << "Trying to create fence with no context"; |
| 45 | 47 |
| 46 scoped_ptr<GLFence> fence; | 48 scoped_ptr<GLFence> fence(new GLFenceNoop); |
| 47 // Prefer ARB_sync which supports server-side wait. | 49 // Prefer ARB_sync which supports server-side wait. |
| 48 if (g_driver_gl.ext.b_GL_ARB_sync || | 50 if (g_driver_gl.ext.b_GL_ARB_sync || |
| 49 GetGLVersionInfo()->is_es3 || | 51 GetGLVersionInfo()->is_es3 || |
| 50 GetGLImplementation() == kGLImplementationDesktopGLCoreProfile) { | 52 GetGLImplementation() == kGLImplementationDesktopGLCoreProfile) { |
| 51 fence.reset(new GLFenceARB); | 53 fence.reset(new GLFenceARB); |
| 52 #if defined(OS_MACOSX) | 54 #if defined(OS_MACOSX) |
| 53 } else if (g_driver_gl.ext.b_GL_APPLE_fence) { | 55 } else if (g_driver_gl.ext.b_GL_APPLE_fence) { |
| 54 fence.reset(new GLFenceAPPLE); | 56 fence.reset(new GLFenceAPPLE); |
| 55 #else | 57 #else |
| 56 } else if (g_driver_egl.ext.b_EGL_KHR_fence_sync) { | 58 } else if (g_driver_egl.ext.b_EGL_KHR_fence_sync) { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 67 bool GLFence::ResetSupported() { | 69 bool GLFence::ResetSupported() { |
| 68 // Resetting a fence to its original state isn't supported by default. | 70 // Resetting a fence to its original state isn't supported by default. |
| 69 return false; | 71 return false; |
| 70 } | 72 } |
| 71 | 73 |
| 72 void GLFence::ResetState() { | 74 void GLFence::ResetState() { |
| 73 NOTIMPLEMENTED(); | 75 NOTIMPLEMENTED(); |
| 74 } | 76 } |
| 75 | 77 |
| 76 } // namespace gfx | 78 } // namespace gfx |
| OLD | NEW |