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 786 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
797 GPU_CLIENT_LOG("[" << this << "] glSwapBuffers()"); | 797 GPU_CLIENT_LOG("[" << this << "] glSwapBuffers()"); |
798 // TODO(piman): Strictly speaking we'd want to insert the token after the | 798 // TODO(piman): Strictly speaking we'd want to insert the token after the |
799 // swap, but the state update with the updated token might not have happened | 799 // swap, but the state update with the updated token might not have happened |
800 // by the time the SwapBuffer callback gets called, forcing us to synchronize | 800 // by the time the SwapBuffer callback gets called, forcing us to synchronize |
801 // with the GPU process more than needed. So instead, make it happen before. | 801 // with the GPU process more than needed. So instead, make it happen before. |
802 // All it means is that we could be slightly looser on the kMaxSwapBuffers | 802 // All it means is that we could be slightly looser on the kMaxSwapBuffers |
803 // semantics if the client doesn't use the callback mechanism, and by chance | 803 // semantics if the client doesn't use the callback mechanism, and by chance |
804 // the scheduler yields between the InsertToken and the SwapBuffers. | 804 // the scheduler yields between the InsertToken and the SwapBuffers. |
805 swap_buffers_tokens_.push(helper_->InsertToken()); | 805 swap_buffers_tokens_.push(helper_->InsertToken()); |
806 helper_->SwapBuffers(); | 806 helper_->SwapBuffers(); |
807 helper_->YieldScheduler(); | |
808 helper_->CommandBufferHelper::Flush(); | 807 helper_->CommandBufferHelper::Flush(); |
809 // Wait if we added too many swap buffers. | 808 // Wait if we added too many swap buffers. |
810 if (swap_buffers_tokens_.size() > kMaxSwapBuffers) { | 809 if (swap_buffers_tokens_.size() > kMaxSwapBuffers) { |
811 helper_->WaitForToken(swap_buffers_tokens_.front()); | 810 helper_->WaitForToken(swap_buffers_tokens_.front()); |
812 swap_buffers_tokens_.pop(); | 811 swap_buffers_tokens_.pop(); |
813 } | 812 } |
814 } | 813 } |
815 | 814 |
816 void GLES2Implementation::CopyTextureToParentTextureCHROMIUM( | 815 void GLES2Implementation::CopyTextureToParentTextureCHROMIUM( |
817 GLuint client_child_id, GLuint client_parent_id) { | 816 GLuint client_child_id, GLuint client_parent_id) { |
(...skipping 1327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2145 GPU_CLIENT_LOG(" returned"); | 2144 GPU_CLIENT_LOG(" returned"); |
2146 GPU_CLIENT_LOG_CODE_BLOCK({ | 2145 GPU_CLIENT_LOG_CODE_BLOCK({ |
2147 for (int i = 0; i < num_results; ++i) { | 2146 for (int i = 0; i < num_results; ++i) { |
2148 GPU_CLIENT_LOG(" " << i << ": " << (results[i])); | 2147 GPU_CLIENT_LOG(" " << i << ": " << (results[i])); |
2149 } | 2148 } |
2150 }); | 2149 }); |
2151 } | 2150 } |
2152 | 2151 |
2153 } // namespace gles2 | 2152 } // namespace gles2 |
2154 } // namespace gpu | 2153 } // namespace gpu |
OLD | NEW |