OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "../client/gles2_implementation.h" | 7 #include "../client/gles2_implementation.h" |
8 #include <GLES2/gles2_command_buffer.h> | 8 #include <GLES2/gles2_command_buffer.h> |
9 #include "../client/mapped_memory.h" | 9 #include "../client/mapped_memory.h" |
10 #include "../common/gles2_cmd_utils.h" | 10 #include "../common/gles2_cmd_utils.h" |
(...skipping 686 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
697 helper_->CommandBufferHelper::Flush(); | 697 helper_->CommandBufferHelper::Flush(); |
698 // Wait if we added too many swap buffers. | 698 // Wait if we added too many swap buffers. |
699 if (swap_buffers_tokens_.size() > kMaxSwapBuffers) { | 699 if (swap_buffers_tokens_.size() > kMaxSwapBuffers) { |
700 helper_->WaitForToken(swap_buffers_tokens_.front()); | 700 helper_->WaitForToken(swap_buffers_tokens_.front()); |
701 swap_buffers_tokens_.pop(); | 701 swap_buffers_tokens_.pop(); |
702 } | 702 } |
703 } | 703 } |
704 | 704 |
705 void GLES2Implementation::CopyTextureToParentTextureCHROMIUM( | 705 void GLES2Implementation::CopyTextureToParentTextureCHROMIUM( |
706 GLuint client_child_id, GLuint client_parent_id) { | 706 GLuint client_child_id, GLuint client_parent_id) { |
707 // Wait if this would add too many CopyTextureToParentTexture's | |
708 if (swap_buffers_tokens_.size() == kMaxSwapBuffers) { | |
709 helper_->WaitForToken(swap_buffers_tokens_.front()); | |
710 swap_buffers_tokens_.pop(); | |
711 } | |
712 helper_->CopyTextureToParentTextureCHROMIUM(client_child_id, | 707 helper_->CopyTextureToParentTextureCHROMIUM(client_child_id, |
713 client_parent_id); | 708 client_parent_id); |
714 swap_buffers_tokens_.push(helper_->InsertToken()); | |
715 Flush(); | |
716 } | 709 } |
717 | 710 |
718 void GLES2Implementation::GenSharedIdsCHROMIUM( | 711 void GLES2Implementation::GenSharedIdsCHROMIUM( |
719 GLuint namespace_id, GLuint id_offset, GLsizei n, GLuint* ids) { | 712 GLuint namespace_id, GLuint id_offset, GLsizei n, GLuint* ids) { |
720 TRACE_EVENT0("gpu", "GLES2::GenSharedIdsCHROMIUM"); | 713 TRACE_EVENT0("gpu", "GLES2::GenSharedIdsCHROMIUM"); |
721 GLint* id_buffer = transfer_buffer_.AllocTyped<GLint>(n); | 714 GLint* id_buffer = transfer_buffer_.AllocTyped<GLint>(n); |
722 helper_->GenSharedIdsCHROMIUM(namespace_id, id_offset, n, | 715 helper_->GenSharedIdsCHROMIUM(namespace_id, id_offset, n, |
723 transfer_buffer_id_, | 716 transfer_buffer_id_, |
724 transfer_buffer_.GetOffset(id_buffer)); | 717 transfer_buffer_.GetOffset(id_buffer)); |
725 WaitForCmd(); | 718 WaitForCmd(); |
(...skipping 990 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1716 // Wait if this would add too many rate limit tokens. | 1709 // Wait if this would add too many rate limit tokens. |
1717 if (rate_limit_tokens_.size() == kMaxSwapBuffers) { | 1710 if (rate_limit_tokens_.size() == kMaxSwapBuffers) { |
1718 helper_->WaitForToken(rate_limit_tokens_.front()); | 1711 helper_->WaitForToken(rate_limit_tokens_.front()); |
1719 rate_limit_tokens_.pop(); | 1712 rate_limit_tokens_.pop(); |
1720 } | 1713 } |
1721 rate_limit_tokens_.push(helper_->InsertToken()); | 1714 rate_limit_tokens_.push(helper_->InsertToken()); |
1722 } | 1715 } |
1723 | 1716 |
1724 } // namespace gles2 | 1717 } // namespace gles2 |
1725 } // namespace gpu | 1718 } // namespace gpu |
OLD | NEW |