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 "gpu/command_buffer/tests/gl_manager.h" | 5 #include "gpu/command_buffer/tests/gl_manager.h" |
6 | 6 |
7 #include <GLES2/gl2.h> | 7 #include <GLES2/gl2.h> |
8 #include <GLES2/gl2ext.h> | 8 #include <GLES2/gl2ext.h> |
9 #include <GLES2/gl2extchromium.h> | 9 #include <GLES2/gl2extchromium.h> |
10 #include <stddef.h> | 10 #include <stddef.h> |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 lose_context_when_out_of_memory(false), | 118 lose_context_when_out_of_memory(false), |
119 context_lost_allowed(false), | 119 context_lost_allowed(false), |
120 context_type(gles2::CONTEXT_TYPE_OPENGLES2), | 120 context_type(gles2::CONTEXT_TYPE_OPENGLES2), |
121 force_shader_name_hashing(false) {} | 121 force_shader_name_hashing(false) {} |
122 | 122 |
123 GLManager::GLManager() | 123 GLManager::GLManager() |
124 : sync_point_manager_(nullptr), | 124 : sync_point_manager_(nullptr), |
125 context_lost_allowed_(false), | 125 context_lost_allowed_(false), |
126 pause_commands_(false), | 126 pause_commands_(false), |
127 paused_order_num_(0), | 127 paused_order_num_(0), |
128 command_buffer_id_(g_next_command_buffer_id++), | 128 command_buffer_id_( |
| 129 CommandBufferId::FromUnsafeValue(g_next_command_buffer_id++)), |
129 next_fence_sync_release_(1) { | 130 next_fence_sync_release_(1) { |
130 SetupBaseContext(); | 131 SetupBaseContext(); |
131 } | 132 } |
132 | 133 |
133 GLManager::~GLManager() { | 134 GLManager::~GLManager() { |
134 --use_count_; | 135 --use_count_; |
135 if (!use_count_) { | 136 if (!use_count_) { |
136 if (base_share_group_) { | 137 if (base_share_group_) { |
137 delete base_context_; | 138 delete base_context_; |
138 base_context_ = NULL; | 139 base_context_ = NULL; |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 ++use_count_; | 339 ++use_count_; |
339 } | 340 } |
340 | 341 |
341 void GLManager::OnFenceSyncRelease(uint64_t release) { | 342 void GLManager::OnFenceSyncRelease(uint64_t release) { |
342 DCHECK(sync_point_client_); | 343 DCHECK(sync_point_client_); |
343 DCHECK(!sync_point_client_->client_state()->IsFenceSyncReleased(release)); | 344 DCHECK(!sync_point_client_->client_state()->IsFenceSyncReleased(release)); |
344 sync_point_client_->ReleaseFenceSync(release); | 345 sync_point_client_->ReleaseFenceSync(release); |
345 } | 346 } |
346 | 347 |
347 bool GLManager::OnWaitFenceSync(gpu::CommandBufferNamespace namespace_id, | 348 bool GLManager::OnWaitFenceSync(gpu::CommandBufferNamespace namespace_id, |
348 uint64_t command_buffer_id, | 349 gpu::CommandBufferId command_buffer_id, |
349 uint64_t release) { | 350 uint64_t release) { |
350 DCHECK(sync_point_client_); | 351 DCHECK(sync_point_client_); |
351 scoped_refptr<gpu::SyncPointClientState> release_state = | 352 scoped_refptr<gpu::SyncPointClientState> release_state = |
352 sync_point_manager_->GetSyncPointClientState(namespace_id, | 353 sync_point_manager_->GetSyncPointClientState(namespace_id, |
353 command_buffer_id); | 354 command_buffer_id); |
354 if (!release_state) | 355 if (!release_state) |
355 return true; | 356 return true; |
356 | 357 |
357 // GLManager does not support being multithreaded at this point, so the fence | 358 // GLManager does not support being multithreaded at this point, so the fence |
358 // sync must be released by the time wait is called. | 359 // sync must be released by the time wait is called. |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
498 } | 499 } |
499 | 500 |
500 void GLManager::EnsureWorkVisible() { | 501 void GLManager::EnsureWorkVisible() { |
501 // This is only relevant for out-of-process command buffers. | 502 // This is only relevant for out-of-process command buffers. |
502 } | 503 } |
503 | 504 |
504 gpu::CommandBufferNamespace GLManager::GetNamespaceID() const { | 505 gpu::CommandBufferNamespace GLManager::GetNamespaceID() const { |
505 return gpu::CommandBufferNamespace::IN_PROCESS; | 506 return gpu::CommandBufferNamespace::IN_PROCESS; |
506 } | 507 } |
507 | 508 |
508 uint64_t GLManager::GetCommandBufferID() const { | 509 CommandBufferId GLManager::GetCommandBufferID() const { |
509 return command_buffer_id_; | 510 return command_buffer_id_; |
510 } | 511 } |
511 | 512 |
512 int32_t GLManager::GetExtraCommandBufferData() const { | 513 int32_t GLManager::GetExtraCommandBufferData() const { |
513 return 0; | 514 return 0; |
514 } | 515 } |
515 | 516 |
516 uint64_t GLManager::GenerateFenceSyncRelease() { | 517 uint64_t GLManager::GenerateFenceSyncRelease() { |
517 return next_fence_sync_release_++; | 518 return next_fence_sync_release_++; |
518 } | 519 } |
(...skipping 26 matching lines...) Expand all Loading... |
545 | 546 |
546 // Something went wrong, just run the callback now. | 547 // Something went wrong, just run the callback now. |
547 callback.Run(); | 548 callback.Run(); |
548 } | 549 } |
549 | 550 |
550 bool GLManager::CanWaitUnverifiedSyncToken(const gpu::SyncToken* sync_token) { | 551 bool GLManager::CanWaitUnverifiedSyncToken(const gpu::SyncToken* sync_token) { |
551 return false; | 552 return false; |
552 } | 553 } |
553 | 554 |
554 } // namespace gpu | 555 } // namespace gpu |
OLD | NEW |