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(); | |
836 helper_->CommandBufferHelper::Flush(); | 835 helper_->CommandBufferHelper::Flush(); |
837 // Wait if we added too many swap buffers. | 836 // Wait if we added too many swap buffers. |
838 if (swap_buffers_tokens_.size() > kMaxSwapBuffers) { | 837 if (swap_buffers_tokens_.size() > kMaxSwapBuffers) { |
839 helper_->WaitForToken(swap_buffers_tokens_.front()); | 838 helper_->WaitForToken(swap_buffers_tokens_.front()); |
840 swap_buffers_tokens_.pop(); | 839 swap_buffers_tokens_.pop(); |
841 } | 840 } |
842 } | 841 } |
843 | 842 |
844 void GLES2Implementation::CopyTextureToParentTextureCHROMIUM( | 843 void GLES2Implementation::CopyTextureToParentTextureCHROMIUM( |
845 GLuint client_child_id, GLuint client_parent_id) { | 844 GLuint client_child_id, GLuint client_parent_id) { |
(...skipping 1437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2283 if (static_cast<size_t>(bufsize) < result.size()) { | 2282 if (static_cast<size_t>(bufsize) < result.size()) { |
2284 SetGLError(GL_INVALID_OPERATION, | 2283 SetGLError(GL_INVALID_OPERATION, |
2285 "glProgramInfoCHROMIUM: bufsize is too small for result."); | 2284 "glProgramInfoCHROMIUM: bufsize is too small for result."); |
2286 return; | 2285 return; |
2287 } | 2286 } |
2288 memcpy(info, &result[0], result.size()); | 2287 memcpy(info, &result[0], result.size()); |
2289 } | 2288 } |
2290 | 2289 |
2291 } // namespace gles2 | 2290 } // namespace gles2 |
2292 } // namespace gpu | 2291 } // namespace gpu |
OLD | NEW |