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_manager_sync.h" | 5 #include "gpu/command_buffer/service/mailbox_manager_sync.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <queue> | 8 #include <queue> |
9 | 9 |
10 #include "base/memory/linked_ptr.h" | 10 #include "base/memory/linked_ptr.h" |
11 #include "base/synchronization/lock.h" | 11 #include "base/synchronization/lock.h" |
12 #include "gpu/command_buffer/common/gles2_cmd_format.h" | 12 #include "gpu/command_buffer/common/sync_token.h" |
13 #include "gpu/command_buffer/service/texture_manager.h" | 13 #include "gpu/command_buffer/service/texture_manager.h" |
14 #include "ui/gl/gl_fence.h" | 14 #include "ui/gl/gl_fence.h" |
15 #include "ui/gl/gl_implementation.h" | 15 #include "ui/gl/gl_implementation.h" |
16 | 16 |
17 #if !defined(OS_MACOSX) | 17 #if !defined(OS_MACOSX) |
18 #include "ui/gl/gl_fence_egl.h" | 18 #include "ui/gl/gl_fence_egl.h" |
19 #endif | 19 #endif |
20 | 20 |
21 namespace gpu { | 21 namespace gpu { |
22 namespace gles2 { | 22 namespace gles2 { |
(...skipping 11 matching lines...) Expand all Loading... |
34 #endif | 34 #endif |
35 | 35 |
36 void CreateFenceLocked(const SyncToken& sync_token) { | 36 void CreateFenceLocked(const SyncToken& sync_token) { |
37 #if !defined(OS_MACOSX) | 37 #if !defined(OS_MACOSX) |
38 g_lock.Get().AssertAcquired(); | 38 g_lock.Get().AssertAcquired(); |
39 if (gfx::GetGLImplementation() == gfx::kGLImplementationMockGL) | 39 if (gfx::GetGLImplementation() == gfx::kGLImplementationMockGL) |
40 return; | 40 return; |
41 | 41 |
42 std::queue<SyncTokenToFenceMap::iterator>& sync_points = g_sync_points.Get(); | 42 std::queue<SyncTokenToFenceMap::iterator>& sync_points = g_sync_points.Get(); |
43 SyncTokenToFenceMap& sync_point_to_fence = g_sync_point_to_fence.Get(); | 43 SyncTokenToFenceMap& sync_point_to_fence = g_sync_point_to_fence.Get(); |
44 if (sync_token.release_count) { | 44 if (sync_token.GetReleaseCount()) { |
45 while (!sync_points.empty() && | 45 while (!sync_points.empty() && |
46 sync_points.front()->second->HasCompleted()) { | 46 sync_points.front()->second->HasCompleted()) { |
47 sync_point_to_fence.erase(sync_points.front()); | 47 sync_point_to_fence.erase(sync_points.front()); |
48 sync_points.pop(); | 48 sync_points.pop(); |
49 } | 49 } |
50 // Need to use EGL fences since we are likely not in a single share group. | 50 // Need to use EGL fences since we are likely not in a single share group. |
51 linked_ptr<gfx::GLFence> fence(make_linked_ptr(new gfx::GLFenceEGL)); | 51 linked_ptr<gfx::GLFence> fence(make_linked_ptr(new gfx::GLFenceEGL)); |
52 if (fence.get()) { | 52 if (fence.get()) { |
53 std::pair<SyncTokenToFenceMap::iterator, bool> result = | 53 std::pair<SyncTokenToFenceMap::iterator, bool> result = |
54 sync_point_to_fence.insert(std::make_pair(sync_token, fence)); | 54 sync_point_to_fence.insert(std::make_pair(sync_token, fence)); |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 | 329 |
330 if (!needs_update.empty()) { | 330 if (!needs_update.empty()) { |
331 for (const TextureUpdatePair& pair : needs_update) { | 331 for (const TextureUpdatePair& pair : needs_update) { |
332 pair.second.UpdateTexture(pair.first); | 332 pair.second.UpdateTexture(pair.first); |
333 } | 333 } |
334 } | 334 } |
335 } | 335 } |
336 | 336 |
337 } // namespace gles2 | 337 } // namespace gles2 |
338 } // namespace gpu | 338 } // namespace gpu |
OLD | NEW |