| 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 // A class to emulate GLES2 over command buffers. | 5 // A class to emulate GLES2 over command buffers. |
| 6 | 6 |
| 7 #include "gpu/command_buffer/client/gles2_implementation.h" | 7 #include "gpu/command_buffer/client/gles2_implementation.h" |
| 8 | 8 |
| 9 #include <GLES2/gl2.h> | 9 #include <GLES2/gl2.h> |
| 10 #include <GLES2/gl2ext.h> | 10 #include <GLES2/gl2ext.h> |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 FreeUnusedSharedMemory(); | 306 FreeUnusedSharedMemory(); |
| 307 transfer_buffer_->Free(); | 307 transfer_buffer_->Free(); |
| 308 helper_->FreeRingBuffer(); | 308 helper_->FreeRingBuffer(); |
| 309 } | 309 } |
| 310 | 310 |
| 311 void GLES2Implementation::RunIfContextNotLost(const base::Closure& callback) { | 311 void GLES2Implementation::RunIfContextNotLost(const base::Closure& callback) { |
| 312 if (!helper_->IsContextLost()) | 312 if (!helper_->IsContextLost()) |
| 313 callback.Run(); | 313 callback.Run(); |
| 314 } | 314 } |
| 315 | 315 |
| 316 void GLES2Implementation::SignalSyncPoint(uint32_t sync_point, | |
| 317 const base::Closure& callback) { | |
| 318 gpu_control_->SignalSyncPoint( | |
| 319 sync_point, | |
| 320 base::Bind(&GLES2Implementation::RunIfContextNotLost, | |
| 321 weak_ptr_factory_.GetWeakPtr(), | |
| 322 callback)); | |
| 323 } | |
| 324 | |
| 325 void GLES2Implementation::SignalSyncToken(const gpu::SyncToken& sync_token, | 316 void GLES2Implementation::SignalSyncToken(const gpu::SyncToken& sync_token, |
| 326 const base::Closure& callback) { | 317 const base::Closure& callback) { |
| 327 if (sync_token.HasData() && | 318 if (sync_token.HasData() && |
| 328 (sync_token.verified_flush() || | 319 (sync_token.verified_flush() || |
| 329 gpu_control_->CanWaitUnverifiedSyncToken(&sync_token))) { | 320 gpu_control_->CanWaitUnverifiedSyncToken(&sync_token))) { |
| 330 | 321 |
| 331 gpu::SyncToken intermediate_sync_token = sync_token; | 322 gpu::SyncToken intermediate_sync_token = sync_token; |
| 332 | 323 |
| 333 // Mark the intermediate sync token as verified if we can wait on | 324 // Mark the intermediate sync token as verified if we can wait on |
| 334 // unverified sync tokens. | 325 // unverified sync tokens. |
| (...skipping 5205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5540 } | 5531 } |
| 5541 if (!buffer->mapped()) { | 5532 if (!buffer->mapped()) { |
| 5542 SetGLError(GL_INVALID_OPERATION, "glUnmapBufferCHROMIUM", "not mapped"); | 5533 SetGLError(GL_INVALID_OPERATION, "glUnmapBufferCHROMIUM", "not mapped"); |
| 5543 return false; | 5534 return false; |
| 5544 } | 5535 } |
| 5545 buffer->set_mapped(false); | 5536 buffer->set_mapped(false); |
| 5546 CheckGLError(); | 5537 CheckGLError(); |
| 5547 return true; | 5538 return true; |
| 5548 } | 5539 } |
| 5549 | 5540 |
| 5550 GLuint GLES2Implementation::InsertFutureSyncPointCHROMIUM() { | |
| 5551 GPU_CLIENT_SINGLE_THREAD_CHECK(); | |
| 5552 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glInsertFutureSyncPointCHROMIUM"); | |
| 5553 DCHECK(capabilities_.future_sync_points); | |
| 5554 return gpu_control_->InsertFutureSyncPoint(); | |
| 5555 } | |
| 5556 | |
| 5557 void GLES2Implementation::RetireSyncPointCHROMIUM(GLuint sync_point) { | |
| 5558 GPU_CLIENT_SINGLE_THREAD_CHECK(); | |
| 5559 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glRetireSyncPointCHROMIUM(" | |
| 5560 << sync_point << ")"); | |
| 5561 DCHECK(capabilities_.future_sync_points); | |
| 5562 helper_->CommandBufferHelper::Flush(); | |
| 5563 gpu_control_->RetireSyncPoint(sync_point); | |
| 5564 } | |
| 5565 | |
| 5566 uint64_t GLES2Implementation::ShareGroupTracingGUID() const { | 5541 uint64_t GLES2Implementation::ShareGroupTracingGUID() const { |
| 5567 return share_group_->TracingGUID(); | 5542 return share_group_->TracingGUID(); |
| 5568 } | 5543 } |
| 5569 | 5544 |
| 5570 GLuint64 GLES2Implementation::InsertFenceSyncCHROMIUM() { | 5545 GLuint64 GLES2Implementation::InsertFenceSyncCHROMIUM() { |
| 5571 const uint64_t release = gpu_control_->GenerateFenceSyncRelease(); | 5546 const uint64_t release = gpu_control_->GenerateFenceSyncRelease(); |
| 5572 helper_->InsertFenceSyncCHROMIUM(release); | 5547 helper_->InsertFenceSyncCHROMIUM(release); |
| 5573 return release; | 5548 return release; |
| 5574 } | 5549 } |
| 5575 | 5550 |
| (...skipping 996 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6572 CheckGLError(); | 6547 CheckGLError(); |
| 6573 } | 6548 } |
| 6574 | 6549 |
| 6575 // Include the auto-generated part of this file. We split this because it means | 6550 // Include the auto-generated part of this file. We split this because it means |
| 6576 // we can easily edit the non-auto generated parts right here in this file | 6551 // we can easily edit the non-auto generated parts right here in this file |
| 6577 // instead of having to edit some template or the code generator. | 6552 // instead of having to edit some template or the code generator. |
| 6578 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" | 6553 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" |
| 6579 | 6554 |
| 6580 } // namespace gles2 | 6555 } // namespace gles2 |
| 6581 } // namespace gpu | 6556 } // namespace gpu |
| OLD | NEW |