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 "gpu/command_buffer/service/mailbox_synchronizer.h" | 5 #include "gpu/command_buffer/service/mailbox_synchronizer.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "gpu/command_buffer/service/mailbox_manager.h" | 8 #include "gpu/command_buffer/service/mailbox_manager.h" |
9 #include "gpu/command_buffer/service/texture_manager.h" | 9 #include "gpu/command_buffer/service/texture_manager.h" |
| 10 #include "ui/gl/gl_fence.h" |
10 #include "ui/gl/gl_implementation.h" | 11 #include "ui/gl/gl_implementation.h" |
11 | 12 |
12 namespace gpu { | 13 namespace gpu { |
13 namespace gles2 { | 14 namespace gles2 { |
14 | 15 |
15 namespace { | 16 namespace { |
16 | 17 |
17 MailboxSynchronizer* g_instance = NULL; | 18 MailboxSynchronizer* g_instance = NULL; |
18 | 19 |
19 } // anonymous namespace | 20 } // anonymous namespace |
20 | 21 |
21 // static | 22 // static |
22 bool MailboxSynchronizer::Initialize() { | 23 bool MailboxSynchronizer::Initialize() { |
23 DCHECK(!g_instance); | 24 DCHECK(!g_instance); |
24 DCHECK(gfx::GetGLImplementation() != gfx::kGLImplementationNone) | 25 DCHECK(gfx::GetGLImplementation() != gfx::kGLImplementationNone) |
25 << "GL bindings not initialized"; | 26 << "GL bindings not initialized"; |
26 switch (gfx::GetGLImplementation()) { | 27 switch (gfx::GetGLImplementation()) { |
27 case gfx::kGLImplementationMockGL: | 28 case gfx::kGLImplementationMockGL: |
28 break; | 29 break; |
29 case gfx::kGLImplementationEGLGLES2: | 30 case gfx::kGLImplementationEGLGLES2: |
30 #if !defined(OS_MACOSX) | 31 #if !defined(OS_MACOSX) |
31 { | 32 { |
32 if (!gfx::g_driver_egl.ext.b_EGL_KHR_image_base || | 33 if (!gfx::g_driver_egl.ext.b_EGL_KHR_image_base || |
33 !gfx::g_driver_egl.ext.b_EGL_KHR_gl_texture_2D_image || | 34 !gfx::g_driver_egl.ext.b_EGL_KHR_gl_texture_2D_image || |
34 !gfx::g_driver_gl.ext.b_GL_OES_EGL_image || | 35 !gfx::g_driver_gl.ext.b_GL_OES_EGL_image || |
35 !gfx::g_driver_egl.ext.b_EGL_KHR_fence_sync) { | 36 !gfx::GLFence::IsSupported()) { |
36 LOG(WARNING) << "MailboxSync not supported due to missing EGL " | 37 LOG(WARNING) << "MailboxSync not supported due to missing EGL " |
37 "image/fence support"; | 38 "image/fence support"; |
38 return false; | 39 return false; |
39 } | 40 } |
40 } | 41 } |
41 break; | 42 break; |
42 #endif | 43 #endif |
43 default: | 44 default: |
44 NOTREACHED(); | 45 NOTREACHED(); |
45 return false; | 46 return false; |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 definition.IsOlderThan(it->second.version)) | 218 definition.IsOlderThan(it->second.version)) |
218 continue; | 219 continue; |
219 it->second.version = definition.version(); | 220 it->second.version = definition.version(); |
220 definition.UpdateTexture(texture); | 221 definition.UpdateTexture(texture); |
221 } | 222 } |
222 } | 223 } |
223 } | 224 } |
224 | 225 |
225 } // namespace gles2 | 226 } // namespace gles2 |
226 } // namespace gpu | 227 } // namespace gpu |
OLD | NEW |