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 "ui/gl/gl_bindings.h" | 8 #include "ui/gl/gl_bindings.h" |
9 #include "ui/gl/gl_context.h" | 9 #include "ui/gl/gl_context.h" |
10 #include "ui/gl/gl_version_info.h" | 10 #include "ui/gl/gl_version_info.h" |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 EGLDisplay display_; | 154 EGLDisplay display_; |
155 scoped_refptr<gfx::GLContext::FlushEvent> flush_event_; | 155 scoped_refptr<gfx::GLContext::FlushEvent> flush_event_; |
156 }; | 156 }; |
157 #endif // !OS_MACOSX | 157 #endif // !OS_MACOSX |
158 | 158 |
159 // static | 159 // static |
160 gfx::GLFence* CreateFence(bool flush) { | 160 gfx::GLFence* CreateFence(bool flush) { |
161 DCHECK(gfx::GLContext::GetCurrent()) | 161 DCHECK(gfx::GLContext::GetCurrent()) |
162 << "Trying to create fence with no context"; | 162 << "Trying to create fence with no context"; |
163 | 163 |
| 164 // Prefer ARB_sync which supports server-side wait. |
| 165 if (gfx::g_driver_gl.ext.b_GL_ARB_sync || |
| 166 gfx::GLContext::GetCurrent()->GetVersionInfo()->is_es3) |
| 167 return new GLFenceARBSync(flush); |
164 #if !defined(OS_MACOSX) | 168 #if !defined(OS_MACOSX) |
165 if (gfx::g_driver_egl.ext.b_EGL_KHR_fence_sync) | 169 if (gfx::g_driver_egl.ext.b_EGL_KHR_fence_sync) |
166 return new EGLFenceSync(flush); | 170 return new EGLFenceSync(flush); |
167 #endif | 171 #endif |
168 // Prefer ARB_sync which supports server-side wait. | |
169 if (gfx::g_driver_gl.ext.b_GL_ARB_sync || | |
170 gfx::GLContext::GetCurrent()->GetVersionInfo()->is_es3) | |
171 return new GLFenceARBSync(flush); | |
172 if (gfx::g_driver_gl.ext.b_GL_NV_fence) | 172 if (gfx::g_driver_gl.ext.b_GL_NV_fence) |
173 return new GLFenceNVFence(flush); | 173 return new GLFenceNVFence(flush); |
174 return NULL; | 174 return NULL; |
175 } | 175 } |
176 | 176 |
177 } // namespace | 177 } // namespace |
178 | 178 |
179 namespace gfx { | 179 namespace gfx { |
180 | 180 |
181 GLFence::GLFence() { | 181 GLFence::GLFence() { |
182 } | 182 } |
183 | 183 |
184 GLFence::~GLFence() { | 184 GLFence::~GLFence() { |
185 } | 185 } |
186 | 186 |
187 GLFence* GLFence::Create() { | 187 GLFence* GLFence::Create() { |
188 return CreateFence(true); | 188 return CreateFence(true); |
189 } | 189 } |
190 | 190 |
191 GLFence* GLFence::CreateWithoutFlush() { | 191 GLFence* GLFence::CreateWithoutFlush() { |
192 return CreateFence(false); | 192 return CreateFence(false); |
193 } | 193 } |
194 | 194 |
195 } // namespace gfx | 195 } // namespace gfx |
OLD | NEW |