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 5529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5540 } | 5540 } |
5541 if (!buffer->mapped()) { | 5541 if (!buffer->mapped()) { |
5542 SetGLError(GL_INVALID_OPERATION, "glUnmapBufferCHROMIUM", "not mapped"); | 5542 SetGLError(GL_INVALID_OPERATION, "glUnmapBufferCHROMIUM", "not mapped"); |
5543 return false; | 5543 return false; |
5544 } | 5544 } |
5545 buffer->set_mapped(false); | 5545 buffer->set_mapped(false); |
5546 CheckGLError(); | 5546 CheckGLError(); |
5547 return true; | 5547 return true; |
5548 } | 5548 } |
5549 | 5549 |
5550 GLuint GLES2Implementation::InsertSyncPointCHROMIUM() { | |
5551 GPU_CLIENT_SINGLE_THREAD_CHECK(); | |
5552 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glInsertSyncPointCHROMIUM"); | |
5553 helper_->CommandBufferHelper::Flush(); | |
5554 return gpu_control_->InsertSyncPoint(); | |
5555 } | |
5556 | |
5557 void GLES2Implementation::WaitSyncPointCHROMIUM(GLuint sync_point) { | |
5558 // This should no longer be called. | |
5559 NOTREACHED(); | |
5560 } | |
5561 | |
5562 GLuint GLES2Implementation::InsertFutureSyncPointCHROMIUM() { | 5550 GLuint GLES2Implementation::InsertFutureSyncPointCHROMIUM() { |
5563 GPU_CLIENT_SINGLE_THREAD_CHECK(); | 5551 GPU_CLIENT_SINGLE_THREAD_CHECK(); |
5564 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glInsertFutureSyncPointCHROMIUM"); | 5552 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glInsertFutureSyncPointCHROMIUM"); |
5565 DCHECK(capabilities_.future_sync_points); | 5553 DCHECK(capabilities_.future_sync_points); |
5566 return gpu_control_->InsertFutureSyncPoint(); | 5554 return gpu_control_->InsertFutureSyncPoint(); |
5567 } | 5555 } |
5568 | 5556 |
5569 void GLES2Implementation::RetireSyncPointCHROMIUM(GLuint sync_point) { | 5557 void GLES2Implementation::RetireSyncPointCHROMIUM(GLuint sync_point) { |
5570 GPU_CLIENT_SINGLE_THREAD_CHECK(); | 5558 GPU_CLIENT_SINGLE_THREAD_CHECK(); |
5571 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glRetireSyncPointCHROMIUM(" | 5559 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glRetireSyncPointCHROMIUM(" |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5680 SyncToken sync_token_data; | 5668 SyncToken sync_token_data; |
5681 memcpy(&sync_token_data, sync_token, sizeof(SyncToken)); | 5669 memcpy(&sync_token_data, sync_token, sizeof(SyncToken)); |
5682 if (sync_token_data.HasData()) { | 5670 if (sync_token_data.HasData()) { |
5683 if (!sync_token_data.verified_flush() && | 5671 if (!sync_token_data.verified_flush() && |
5684 !gpu_control_->CanWaitUnverifiedSyncToken(&sync_token_data)) { | 5672 !gpu_control_->CanWaitUnverifiedSyncToken(&sync_token_data)) { |
5685 SetGLError(GL_INVALID_VALUE, "glWaitSyncTokenCHROMIUM", | 5673 SetGLError(GL_INVALID_VALUE, "glWaitSyncTokenCHROMIUM", |
5686 "Cannot wait on sync_token which has not been verified"); | 5674 "Cannot wait on sync_token which has not been verified"); |
5687 return; | 5675 return; |
5688 } | 5676 } |
5689 | 5677 |
5690 // TODO(dyen): Temporarily support old sync points, remove once all old | |
5691 // sync points have been removed. | |
5692 const gpu::CommandBufferNamespace namespace_id = | |
5693 sync_token_data.namespace_id(); | |
5694 if (namespace_id == gpu::CommandBufferNamespace::OLD_SYNC_POINTS) { | |
5695 const uint32_t sync_point = | |
5696 static_cast<uint32_t>(sync_token_data.release_count()); | |
5697 helper_->WaitSyncPointCHROMIUM(sync_point); | |
5698 return; | |
5699 } | |
5700 | |
5701 helper_->WaitSyncTokenCHROMIUM( | 5678 helper_->WaitSyncTokenCHROMIUM( |
5702 static_cast<GLint>(sync_token_data.namespace_id()), | 5679 static_cast<GLint>(sync_token_data.namespace_id()), |
5703 sync_token_data.command_buffer_id(), sync_token_data.release_count()); | 5680 sync_token_data.command_buffer_id(), sync_token_data.release_count()); |
5704 } | 5681 } |
5705 } | 5682 } |
5706 } | 5683 } |
5707 | 5684 |
5708 namespace { | 5685 namespace { |
5709 | 5686 |
5710 bool ValidImageFormat(GLenum internalformat, | 5687 bool ValidImageFormat(GLenum internalformat, |
(...skipping 884 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6595 CheckGLError(); | 6572 CheckGLError(); |
6596 } | 6573 } |
6597 | 6574 |
6598 // Include the auto-generated part of this file. We split this because it means | 6575 // Include the auto-generated part of this file. We split this because it means |
6599 // we can easily edit the non-auto generated parts right here in this file | 6576 // we can easily edit the non-auto generated parts right here in this file |
6600 // instead of having to edit some template or the code generator. | 6577 // instead of having to edit some template or the code generator. |
6601 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" | 6578 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" |
6602 | 6579 |
6603 } // namespace gles2 | 6580 } // namespace gles2 |
6604 } // namespace gpu | 6581 } // namespace gpu |
OLD | NEW |