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 814 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
825 GPU_CLIENT_LOG("[" << this << "] glSwapBuffers()"); | 825 GPU_CLIENT_LOG("[" << this << "] glSwapBuffers()"); |
826 // TODO(piman): Strictly speaking we'd want to insert the token after the | 826 // TODO(piman): Strictly speaking we'd want to insert the token after the |
827 // swap, but the state update with the updated token might not have happened | 827 // swap, but the state update with the updated token might not have happened |
828 // by the time the SwapBuffer callback gets called, forcing us to synchronize | 828 // by the time the SwapBuffer callback gets called, forcing us to synchronize |
829 // with the GPU process more than needed. So instead, make it happen before. | 829 // with the GPU process more than needed. So instead, make it happen before. |
830 // All it means is that we could be slightly looser on the kMaxSwapBuffers | 830 // All it means is that we could be slightly looser on the kMaxSwapBuffers |
831 // semantics if the client doesn't use the callback mechanism, and by chance | 831 // semantics if the client doesn't use the callback mechanism, and by chance |
832 // the scheduler yields between the InsertToken and the SwapBuffers. | 832 // the scheduler yields between the InsertToken and the SwapBuffers. |
833 swap_buffers_tokens_.push(helper_->InsertToken()); | 833 swap_buffers_tokens_.push(helper_->InsertToken()); |
834 helper_->SwapBuffers(); | 834 helper_->SwapBuffers(); |
| 835 helper_->YieldScheduler(); |
835 helper_->CommandBufferHelper::Flush(); | 836 helper_->CommandBufferHelper::Flush(); |
836 // Wait if we added too many swap buffers. | 837 // Wait if we added too many swap buffers. |
837 if (swap_buffers_tokens_.size() > kMaxSwapBuffers) { | 838 if (swap_buffers_tokens_.size() > kMaxSwapBuffers) { |
838 helper_->WaitForToken(swap_buffers_tokens_.front()); | 839 helper_->WaitForToken(swap_buffers_tokens_.front()); |
839 swap_buffers_tokens_.pop(); | 840 swap_buffers_tokens_.pop(); |
840 } | 841 } |
841 } | 842 } |
842 | 843 |
843 void GLES2Implementation::CopyTextureToParentTextureCHROMIUM( | 844 void GLES2Implementation::CopyTextureToParentTextureCHROMIUM( |
844 GLuint client_child_id, GLuint client_parent_id) { | 845 GLuint client_child_id, GLuint client_parent_id) { |
(...skipping 1437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2282 if (static_cast<size_t>(bufsize) < result.size()) { | 2283 if (static_cast<size_t>(bufsize) < result.size()) { |
2283 SetGLError(GL_INVALID_OPERATION, | 2284 SetGLError(GL_INVALID_OPERATION, |
2284 "glProgramInfoCHROMIUM: bufsize is too small for result."); | 2285 "glProgramInfoCHROMIUM: bufsize is too small for result."); |
2285 return; | 2286 return; |
2286 } | 2287 } |
2287 memcpy(info, &result[0], result.size()); | 2288 memcpy(info, &result[0], result.size()); |
2288 } | 2289 } |
2289 | 2290 |
2290 } // namespace gles2 | 2291 } // namespace gles2 |
2291 } // namespace gpu | 2292 } // namespace gpu |
OLD | NEW |