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

Side by Side Diff: android_webview/browser/hardware_renderer.cc

Issue 1335033004: Make sure FBO is correct for both kModeProcess and kModeDraw (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Set FBO before any GL runs Created 5 years, 3 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #include "android_webview/browser/hardware_renderer.h" 5 #include "android_webview/browser/hardware_renderer.h"
6 6
7 #include "android_webview/browser/aw_gl_surface.h" 7 #include "android_webview/browser/aw_gl_surface.h"
8 #include "android_webview/browser/aw_render_thread_context_provider.h" 8 #include "android_webview/browser/aw_render_thread_context_provider.h"
9 #include "android_webview/browser/child_frame.h" 9 #include "android_webview/browser/child_frame.h"
10 #include "android_webview/browser/deferred_gpu_command_service.h" 10 #include "android_webview/browser/deferred_gpu_command_service.h"
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 surface_factory_->Destroy(child_id_); 99 surface_factory_->Destroy(child_id_);
100 child_id_ = surface_id_allocator_->GenerateId(); 100 child_id_ = surface_id_allocator_->GenerateId();
101 surface_factory_->Create(child_id_); 101 surface_factory_->Create(child_id_);
102 } 102 }
103 103
104 surface_factory_->SubmitCompositorFrame(child_id_, frame.Pass(), 104 surface_factory_->SubmitCompositorFrame(child_id_, frame.Pass(),
105 cc::SurfaceFactory::DrawCallback()); 105 cc::SurfaceFactory::DrawCallback());
106 } 106 }
107 107
108 void HardwareRenderer::DrawGL(bool stencil_enabled, 108 void HardwareRenderer::DrawGL(bool stencil_enabled,
109 int framebuffer_binding_ext,
110 AwDrawGLInfo* draw_info) { 109 AwDrawGLInfo* draw_info) {
111 TRACE_EVENT0("android_webview", "HardwareRenderer::DrawGL"); 110 TRACE_EVENT0("android_webview", "HardwareRenderer::DrawGL");
112 111
113 // We need to watch if the current Android context has changed and enforce 112 // We need to watch if the current Android context has changed and enforce
114 // a clean-up in the compositor. 113 // a clean-up in the compositor.
115 EGLContext current_context = eglGetCurrentContext(); 114 EGLContext current_context = eglGetCurrentContext();
116 DCHECK(current_context) << "DrawGL called without EGLContext"; 115 DCHECK(current_context) << "DrawGL called without EGLContext";
117 116
118 // TODO(boliu): Handle context loss. 117 // TODO(boliu): Handle context loss.
119 if (last_egl_context_ != current_context) 118 if (last_egl_context_ != current_context)
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 if (root_id_.is_null()) { 167 if (root_id_.is_null()) {
169 root_id_ = surface_id_allocator_->GenerateId(); 168 root_id_ = surface_id_allocator_->GenerateId();
170 surface_factory_->Create(root_id_); 169 surface_factory_->Create(root_id_);
171 display_->SetSurfaceId(root_id_, 1.f); 170 display_->SetSurfaceId(root_id_, 1.f);
172 } 171 }
173 surface_factory_->SubmitCompositorFrame(root_id_, frame.Pass(), 172 surface_factory_->SubmitCompositorFrame(root_id_, frame.Pass(),
174 cc::SurfaceFactory::DrawCallback()); 173 cc::SurfaceFactory::DrawCallback());
175 174
176 display_->Resize(viewport); 175 display_->Resize(viewport);
177 176
178 gl_surface_->SetBackingFrameBufferObject(framebuffer_binding_ext);
179 if (!output_surface_) { 177 if (!output_surface_) {
180 scoped_refptr<cc::ContextProvider> context_provider = 178 scoped_refptr<cc::ContextProvider> context_provider =
181 AwRenderThreadContextProvider::Create( 179 AwRenderThreadContextProvider::Create(
182 gl_surface_, DeferredGpuCommandService::GetInstance()); 180 gl_surface_, DeferredGpuCommandService::GetInstance());
183 scoped_ptr<ParentOutputSurface> output_surface_holder( 181 scoped_ptr<ParentOutputSurface> output_surface_holder(
184 new ParentOutputSurface(context_provider)); 182 new ParentOutputSurface(context_provider));
185 output_surface_ = output_surface_holder.get(); 183 output_surface_ = output_surface_holder.get();
186 display_->Initialize(output_surface_holder.Pass(), nullptr); 184 display_->Initialize(output_surface_holder.Pass(), nullptr);
187 } 185 }
188 output_surface_->SetExternalStencilTest(stencil_enabled); 186 output_surface_->SetExternalStencilTest(stencil_enabled);
189 display_->SetExternalClip(clip); 187 display_->SetExternalClip(clip);
190 display_->DrawAndSwap(); 188 display_->DrawAndSwap();
191 gl_surface_->ResetBackingFrameBufferObject(); 189 gl_surface_->ResetBackingFrameBufferObject();
boliu 2015/09/14 21:25:35 Remove this too (and implementation)
hush (inactive) 2015/09/14 23:00:27 Done.
192 } 190 }
193 191
194 void HardwareRenderer::ReturnResources( 192 void HardwareRenderer::ReturnResources(
195 const cc::ReturnedResourceArray& resources) { 193 const cc::ReturnedResourceArray& resources) {
196 shared_renderer_state_->InsertReturnedResourcesOnRT(resources); 194 shared_renderer_state_->InsertReturnedResourcesOnRT(resources);
197 } 195 }
198 196
197 void HardwareRenderer::SetBackingFrameBufferObject(
198 int framebuffer_binding_ext) {
199 gl_surface_->SetBackingFrameBufferObject(framebuffer_binding_ext);
200 }
201
199 } // namespace android_webview 202 } // namespace android_webview
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698