OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "gpu/command_buffer/client/gles2_implementation.h" | 7 #include "gpu/command_buffer/client/gles2_implementation.h" |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <map> | 10 #include <map> |
(...skipping 2773 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2784 | 2784 |
2785 void GLES2Implementation::PartialSwapBuffers(gfx::Rect sub_buffer) { | 2785 void GLES2Implementation::PartialSwapBuffers(gfx::Rect sub_buffer) { |
2786 PostSubBufferCHROMIUM(sub_buffer.x(), | 2786 PostSubBufferCHROMIUM(sub_buffer.x(), |
2787 sub_buffer.y(), | 2787 sub_buffer.y(), |
2788 sub_buffer.width(), | 2788 sub_buffer.width(), |
2789 sub_buffer.height()); | 2789 sub_buffer.height()); |
2790 gpu_control_->Echo(base::Bind(&GLES2Implementation::OnSwapBuffersComplete, | 2790 gpu_control_->Echo(base::Bind(&GLES2Implementation::OnSwapBuffersComplete, |
2791 weak_ptr_factory_.GetWeakPtr())); | 2791 weak_ptr_factory_.GetWeakPtr())); |
2792 } | 2792 } |
2793 | 2793 |
| 2794 void GLES2Implementation::SetOverlayPlane(int plane_id, |
| 2795 int texture_id, |
| 2796 gfx::Rect sub_buffer) { |
| 2797 SetOverlayPlaneCHROMIUM(plane_id, |
| 2798 texture_id, |
| 2799 sub_buffer.x(), |
| 2800 sub_buffer.y(), |
| 2801 sub_buffer.width(), |
| 2802 sub_buffer.height()); |
| 2803 } |
| 2804 |
2794 void GLES2Implementation::SetSwapBuffersCompleteCallback( | 2805 void GLES2Implementation::SetSwapBuffersCompleteCallback( |
2795 const base::Closure& swap_buffers_complete_callback) { | 2806 const base::Closure& swap_buffers_complete_callback) { |
2796 swap_buffers_complete_callback_ = swap_buffers_complete_callback; | 2807 swap_buffers_complete_callback_ = swap_buffers_complete_callback; |
2797 } | 2808 } |
2798 | 2809 |
2799 void GLES2Implementation::OnSwapBuffersComplete() { | 2810 void GLES2Implementation::OnSwapBuffersComplete() { |
2800 if (!swap_buffers_complete_callback_.is_null()) | 2811 if (!swap_buffers_complete_callback_.is_null()) |
2801 swap_buffers_complete_callback_.Run(); | 2812 swap_buffers_complete_callback_.Run(); |
2802 } | 2813 } |
2803 | 2814 |
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3244 // Same flow control as GLES2Implementation::SwapBuffers (see comments there). | 3255 // Same flow control as GLES2Implementation::SwapBuffers (see comments there). |
3245 swap_buffers_tokens_.push(helper_->InsertToken()); | 3256 swap_buffers_tokens_.push(helper_->InsertToken()); |
3246 helper_->PostSubBufferCHROMIUM(x, y, width, height); | 3257 helper_->PostSubBufferCHROMIUM(x, y, width, height); |
3247 helper_->CommandBufferHelper::Flush(); | 3258 helper_->CommandBufferHelper::Flush(); |
3248 if (swap_buffers_tokens_.size() > kMaxSwapBuffers + 1) { | 3259 if (swap_buffers_tokens_.size() > kMaxSwapBuffers + 1) { |
3249 helper_->WaitForToken(swap_buffers_tokens_.front()); | 3260 helper_->WaitForToken(swap_buffers_tokens_.front()); |
3250 swap_buffers_tokens_.pop(); | 3261 swap_buffers_tokens_.pop(); |
3251 } | 3262 } |
3252 } | 3263 } |
3253 | 3264 |
| 3265 void GLES2Implementation::SetOverlayPlaneCHROMIUM(GLint plane_id, |
| 3266 GLenum texture_id, |
| 3267 GLint x, |
| 3268 GLint y, |
| 3269 GLint width, |
| 3270 GLint height) { |
| 3271 helper_->SetOverlayPlaneCHROMIUM(plane_id, texture_id, x, y, width, height); |
| 3272 } |
| 3273 |
3254 void GLES2Implementation::DeleteQueriesEXTHelper( | 3274 void GLES2Implementation::DeleteQueriesEXTHelper( |
3255 GLsizei n, const GLuint* queries) { | 3275 GLsizei n, const GLuint* queries) { |
3256 // TODO(gman): Remove this as queries are not shared resources. | 3276 // TODO(gman): Remove this as queries are not shared resources. |
3257 if (!GetIdHandler(id_namespaces::kQueries)->FreeIds( | 3277 if (!GetIdHandler(id_namespaces::kQueries)->FreeIds( |
3258 this, n, queries, &GLES2Implementation::DeleteQueriesStub)) { | 3278 this, n, queries, &GLES2Implementation::DeleteQueriesStub)) { |
3259 SetGLError( | 3279 SetGLError( |
3260 GL_INVALID_VALUE, | 3280 GL_INVALID_VALUE, |
3261 "glDeleteTextures", "id not created by this context."); | 3281 "glDeleteTextures", "id not created by this context."); |
3262 return; | 3282 return; |
3263 } | 3283 } |
(...skipping 651 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3915 CheckGLError(); | 3935 CheckGLError(); |
3916 } | 3936 } |
3917 | 3937 |
3918 // Include the auto-generated part of this file. We split this because it means | 3938 // Include the auto-generated part of this file. We split this because it means |
3919 // we can easily edit the non-auto generated parts right here in this file | 3939 // we can easily edit the non-auto generated parts right here in this file |
3920 // instead of having to edit some template or the code generator. | 3940 // instead of having to edit some template or the code generator. |
3921 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" | 3941 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" |
3922 | 3942 |
3923 } // namespace gles2 | 3943 } // namespace gles2 |
3924 } // namespace gpu | 3944 } // namespace gpu |
OLD | NEW |