| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 emluate GLES2 over command buffers. | 5 // A class to emluate 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 671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 682 // Wait if this would add too many swap buffers. | 682 // Wait if this would add too many swap buffers. |
| 683 if (swap_buffers_tokens_.size() == kMaxSwapBuffers) { | 683 if (swap_buffers_tokens_.size() == kMaxSwapBuffers) { |
| 684 helper_->WaitForToken(swap_buffers_tokens_.front()); | 684 helper_->WaitForToken(swap_buffers_tokens_.front()); |
| 685 swap_buffers_tokens_.pop(); | 685 swap_buffers_tokens_.pop(); |
| 686 } | 686 } |
| 687 helper_->SwapBuffers(); | 687 helper_->SwapBuffers(); |
| 688 swap_buffers_tokens_.push(helper_->InsertToken()); | 688 swap_buffers_tokens_.push(helper_->InsertToken()); |
| 689 Flush(); | 689 Flush(); |
| 690 } | 690 } |
| 691 | 691 |
| 692 void GLES2Implementation::CopyTextureToParentTextureCHROMIUM( |
| 693 GLuint client_child_id, GLuint client_parent_id) { |
| 694 // Wait if this would add too many CopyTextureToParentTexture's |
| 695 if (swap_buffers_tokens_.size() == kMaxSwapBuffers) { |
| 696 helper_->WaitForToken(swap_buffers_tokens_.front()); |
| 697 swap_buffers_tokens_.pop(); |
| 698 } |
| 699 helper_->CopyTextureToParentTextureCHROMIUM(client_child_id, |
| 700 client_parent_id); |
| 701 swap_buffers_tokens_.push(helper_->InsertToken()); |
| 702 Flush(); |
| 703 } |
| 704 |
| 692 void GLES2Implementation::GenSharedIdsCHROMIUM( | 705 void GLES2Implementation::GenSharedIdsCHROMIUM( |
| 693 GLuint namespace_id, GLuint id_offset, GLsizei n, GLuint* ids) { | 706 GLuint namespace_id, GLuint id_offset, GLsizei n, GLuint* ids) { |
| 694 GLint* id_buffer = transfer_buffer_.AllocTyped<GLint>(n); | 707 GLint* id_buffer = transfer_buffer_.AllocTyped<GLint>(n); |
| 695 helper_->GenSharedIdsCHROMIUM(namespace_id, id_offset, n, | 708 helper_->GenSharedIdsCHROMIUM(namespace_id, id_offset, n, |
| 696 transfer_buffer_id_, | 709 transfer_buffer_id_, |
| 697 transfer_buffer_.GetOffset(id_buffer)); | 710 transfer_buffer_.GetOffset(id_buffer)); |
| 698 WaitForCmd(); | 711 WaitForCmd(); |
| 699 memcpy(ids, id_buffer, sizeof(*ids) * n); | 712 memcpy(ids, id_buffer, sizeof(*ids) * n); |
| 700 transfer_buffer_.FreePendingToken(id_buffer, helper_->InsertToken()); | 713 transfer_buffer_.FreePendingToken(id_buffer, helper_->InsertToken()); |
| 701 } | 714 } |
| (...skipping 939 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1641 } | 1654 } |
| 1642 | 1655 |
| 1643 void GLES2Implementation::RequestExtensionCHROMIUM(const char* extension) { | 1656 void GLES2Implementation::RequestExtensionCHROMIUM(const char* extension) { |
| 1644 SetBucketAsCString(kResultBucketId, extension); | 1657 SetBucketAsCString(kResultBucketId, extension); |
| 1645 helper_->RequestExtensionCHROMIUM(kResultBucketId); | 1658 helper_->RequestExtensionCHROMIUM(kResultBucketId); |
| 1646 helper_->SetBucketSize(kResultBucketId, 0); | 1659 helper_->SetBucketSize(kResultBucketId, 0); |
| 1647 } | 1660 } |
| 1648 | 1661 |
| 1649 } // namespace gles2 | 1662 } // namespace gles2 |
| 1650 } // namespace gpu | 1663 } // namespace gpu |
| OLD | NEW |