| 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_implementation.h" |
| 10 | 11 |
| 11 namespace gpu { | 12 namespace gpu { |
| 12 namespace gles2 { | 13 namespace gles2 { |
| 13 | 14 |
| 14 namespace { | 15 namespace { |
| 15 | 16 |
| 16 MailboxSynchronizer* g_instance = NULL; | 17 MailboxSynchronizer* g_instance = NULL; |
| 17 | 18 |
| 18 } // anonymous namespace | 19 } // anonymous namespace |
| 19 | 20 |
| 20 // static | 21 // static |
| 21 bool MailboxSynchronizer::Initialize() { | 22 bool MailboxSynchronizer::Initialize() { |
| 22 DCHECK(!g_instance); | 23 DCHECK(!g_instance); |
| 24 DCHECK(gfx::GetGLImplementation() != gfx::kGLImplementationNone) |
| 25 << "GL bindings not initialized"; |
| 26 switch (gfx::GetGLImplementation()) { |
| 27 case gfx::kGLImplementationMockGL: |
| 28 break; |
| 29 case gfx::kGLImplementationEGLGLES2: |
| 30 #if !defined(OS_MACOSX) |
| 31 { |
| 32 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_gl.ext.b_GL_OES_EGL_image || |
| 35 !gfx::g_driver_egl.ext.b_EGL_KHR_fence_sync) { |
| 36 LOG(WARNING) << "MailboxSync not supported due to missing EGL " |
| 37 "image/fence support"; |
| 38 return false; |
| 39 } |
| 40 } |
| 41 break; |
| 42 #endif |
| 43 default: |
| 44 NOTREACHED(); |
| 45 return false; |
| 46 } |
| 23 g_instance = new MailboxSynchronizer; | 47 g_instance = new MailboxSynchronizer; |
| 24 return true; | 48 return true; |
| 25 } | 49 } |
| 26 | 50 |
| 27 // static | 51 // static |
| 28 void MailboxSynchronizer::Terminate() { | 52 void MailboxSynchronizer::Terminate() { |
| 29 DCHECK(g_instance); | 53 DCHECK(g_instance); |
| 30 delete g_instance; | 54 delete g_instance; |
| 31 g_instance = NULL; | 55 g_instance = NULL; |
| 32 } | 56 } |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 definition.IsOlderThan(it->second.version)) | 219 definition.IsOlderThan(it->second.version)) |
| 196 continue; | 220 continue; |
| 197 it->second.version = definition.version(); | 221 it->second.version = definition.version(); |
| 198 definition.UpdateTexture(texture); | 222 definition.UpdateTexture(texture); |
| 199 } | 223 } |
| 200 } | 224 } |
| 201 } | 225 } |
| 202 | 226 |
| 203 } // namespace gles2 | 227 } // namespace gles2 |
| 204 } // namespace gpu | 228 } // namespace gpu |
| OLD | NEW |