Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(107)

Side by Side Diff: gpu/command_buffer/client/gles2_implementation.cc

Issue 619453002: gpu: Remove Echo and SwapCompletion GL interfacess (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@tits
Patch Set: rebase Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <GLES2/gl2ext.h> 9 #include <GLES2/gl2ext.h>
10 #include <GLES2/gl2extchromium.h> 10 #include <GLES2/gl2extchromium.h>
(...skipping 2829 matching lines...) Expand 10 before | Expand all | Expand 10 after
2840 WaitForCmd(); 2840 WaitForCmd();
2841 result->CopyResult(params); 2841 result->CopyResult(params);
2842 GPU_CLIENT_LOG_CODE_BLOCK({ 2842 GPU_CLIENT_LOG_CODE_BLOCK({
2843 for (int32 i = 0; i < result->GetNumResults(); ++i) { 2843 for (int32 i = 0; i < result->GetNumResults(); ++i) {
2844 GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]); 2844 GPU_CLIENT_LOG(" " << i << ": " << result->GetData()[i]);
2845 } 2845 }
2846 }); 2846 });
2847 CheckGLError(); 2847 CheckGLError();
2848 } 2848 }
2849 2849
2850 void GLES2Implementation::Swap() {
2851 SwapBuffers();
2852 gpu_control_->Echo(
2853 base::Bind(&GLES2Implementation::OnSwapBuffersComplete,
2854 weak_ptr_factory_.GetWeakPtr()));
2855 }
2856
2857 void GLES2Implementation::PartialSwapBuffers(const gfx::Rect& sub_buffer) {
2858 PostSubBufferCHROMIUM(sub_buffer.x(),
2859 sub_buffer.y(),
2860 sub_buffer.width(),
2861 sub_buffer.height());
2862 gpu_control_->Echo(base::Bind(&GLES2Implementation::OnSwapBuffersComplete,
2863 weak_ptr_factory_.GetWeakPtr()));
2864 }
2865
2866 void GLES2Implementation::SetSwapBuffersCompleteCallback(
2867 const base::Closure& swap_buffers_complete_callback) {
2868 swap_buffers_complete_callback_ = swap_buffers_complete_callback;
2869 }
2870
2871 static GLenum GetGLESOverlayTransform(gfx::OverlayTransform plane_transform) { 2850 static GLenum GetGLESOverlayTransform(gfx::OverlayTransform plane_transform) {
2872 switch (plane_transform) { 2851 switch (plane_transform) {
2873 case gfx::OVERLAY_TRANSFORM_INVALID: 2852 case gfx::OVERLAY_TRANSFORM_INVALID:
2874 break; 2853 break;
2875 case gfx::OVERLAY_TRANSFORM_NONE: 2854 case gfx::OVERLAY_TRANSFORM_NONE:
2876 return GL_OVERLAY_TRANSFORM_NONE_CHROMIUM; 2855 return GL_OVERLAY_TRANSFORM_NONE_CHROMIUM;
2877 case gfx::OVERLAY_TRANSFORM_FLIP_HORIZONTAL: 2856 case gfx::OVERLAY_TRANSFORM_FLIP_HORIZONTAL:
2878 return GL_OVERLAY_TRANSFORM_FLIP_HORIZONTAL_CHROMIUM; 2857 return GL_OVERLAY_TRANSFORM_FLIP_HORIZONTAL_CHROMIUM;
2879 case gfx::OVERLAY_TRANSFORM_FLIP_VERTICAL: 2858 case gfx::OVERLAY_TRANSFORM_FLIP_VERTICAL:
2880 return GL_OVERLAY_TRANSFORM_FLIP_VERTICAL_CHROMIUM; 2859 return GL_OVERLAY_TRANSFORM_FLIP_VERTICAL_CHROMIUM;
(...skipping 20 matching lines...) Expand all
2901 display_bounds.x(), 2880 display_bounds.x(),
2902 display_bounds.y(), 2881 display_bounds.y(),
2903 display_bounds.width(), 2882 display_bounds.width(),
2904 display_bounds.height(), 2883 display_bounds.height(),
2905 uv_rect.x(), 2884 uv_rect.x(),
2906 uv_rect.y(), 2885 uv_rect.y(),
2907 uv_rect.width(), 2886 uv_rect.width(),
2908 uv_rect.height()); 2887 uv_rect.height());
2909 } 2888 }
2910 2889
2911 void GLES2Implementation::OnSwapBuffersComplete() {
2912 if (!swap_buffers_complete_callback_.is_null())
2913 swap_buffers_complete_callback_.Run();
2914 }
2915
2916 GLboolean GLES2Implementation::EnableFeatureCHROMIUM( 2890 GLboolean GLES2Implementation::EnableFeatureCHROMIUM(
2917 const char* feature) { 2891 const char* feature) {
2918 GPU_CLIENT_SINGLE_THREAD_CHECK(); 2892 GPU_CLIENT_SINGLE_THREAD_CHECK();
2919 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glEnableFeatureCHROMIUM(" 2893 GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glEnableFeatureCHROMIUM("
2920 << feature << ")"); 2894 << feature << ")");
2921 TRACE_EVENT0("gpu", "GLES2::EnableFeatureCHROMIUM"); 2895 TRACE_EVENT0("gpu", "GLES2::EnableFeatureCHROMIUM");
2922 typedef cmds::EnableFeatureCHROMIUM::Result Result; 2896 typedef cmds::EnableFeatureCHROMIUM::Result Result;
2923 Result* result = GetResultAs<Result*>(); 2897 Result* result = GetResultAs<Result*>();
2924 if (!result) { 2898 if (!result) {
2925 return false; 2899 return false;
(...skipping 1264 matching lines...) Expand 10 before | Expand all | Expand 10 after
4190 return true; 4164 return true;
4191 } 4165 }
4192 4166
4193 // Include the auto-generated part of this file. We split this because it means 4167 // Include the auto-generated part of this file. We split this because it means
4194 // we can easily edit the non-auto generated parts right here in this file 4168 // we can easily edit the non-auto generated parts right here in this file
4195 // instead of having to edit some template or the code generator. 4169 // instead of having to edit some template or the code generator.
4196 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" 4170 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h"
4197 4171
4198 } // namespace gles2 4172 } // namespace gles2
4199 } // namespace gpu 4173 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698