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

Side by Side Diff: cc/output/gl_renderer.cc

Issue 132163004: Remove WebGraphicsContext3D getter from cc::ContextProvider (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2010 The Chromium Authors. All rights reserved. 1 // Copyright 2010 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 "cc/output/gl_renderer.h" 5 #include "cc/output/gl_renderer.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 22 matching lines...) Expand all
33 #include "cc/resources/layer_quad.h" 33 #include "cc/resources/layer_quad.h"
34 #include "cc/resources/scoped_resource.h" 34 #include "cc/resources/scoped_resource.h"
35 #include "cc/resources/texture_mailbox_deleter.h" 35 #include "cc/resources/texture_mailbox_deleter.h"
36 #include "cc/trees/damage_tracker.h" 36 #include "cc/trees/damage_tracker.h"
37 #include "cc/trees/proxy.h" 37 #include "cc/trees/proxy.h"
38 #include "cc/trees/single_thread_proxy.h" 38 #include "cc/trees/single_thread_proxy.h"
39 #include "gpu/GLES2/gl2extchromium.h" 39 #include "gpu/GLES2/gl2extchromium.h"
40 #include "gpu/command_buffer/client/context_support.h" 40 #include "gpu/command_buffer/client/context_support.h"
41 #include "gpu/command_buffer/client/gles2_interface.h" 41 #include "gpu/command_buffer/client/gles2_interface.h"
42 #include "gpu/command_buffer/common/gpu_memory_allocation.h" 42 #include "gpu/command_buffer/common/gpu_memory_allocation.h"
43 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h"
44 #include "third_party/khronos/GLES2/gl2.h" 43 #include "third_party/khronos/GLES2/gl2.h"
45 #include "third_party/khronos/GLES2/gl2ext.h" 44 #include "third_party/khronos/GLES2/gl2ext.h"
46 #include "third_party/skia/include/core/SkBitmap.h" 45 #include "third_party/skia/include/core/SkBitmap.h"
47 #include "third_party/skia/include/core/SkColor.h" 46 #include "third_party/skia/include/core/SkColor.h"
48 #include "third_party/skia/include/core/SkColorFilter.h" 47 #include "third_party/skia/include/core/SkColorFilter.h"
49 #include "third_party/skia/include/core/SkSurface.h" 48 #include "third_party/skia/include/core/SkSurface.h"
50 #include "third_party/skia/include/gpu/GrContext.h" 49 #include "third_party/skia/include/gpu/GrContext.h"
51 #include "third_party/skia/include/gpu/GrTexture.h" 50 #include "third_party/skia/include/gpu/GrTexture.h"
52 #include "third_party/skia/include/gpu/SkGpuDevice.h" 51 #include "third_party/skia/include/gpu/SkGpuDevice.h"
53 #include "third_party/skia/include/gpu/SkGrTexturePixelRef.h" 52 #include "third_party/skia/include/gpu/SkGrTexturePixelRef.h"
54 #include "third_party/skia/include/gpu/gl/GrGLInterface.h" 53 #include "third_party/skia/include/gpu/gl/GrGLInterface.h"
55 #include "ui/gfx/quad_f.h" 54 #include "ui/gfx/quad_f.h"
56 #include "ui/gfx/rect_conversions.h" 55 #include "ui/gfx/rect_conversions.h"
57 56
58 using blink::WebGraphicsContext3D;
59 using gpu::gles2::GLES2Interface; 57 using gpu::gles2::GLES2Interface;
60 58
61 namespace cc { 59 namespace cc {
62 60
63 namespace { 61 namespace {
64 62
65 // TODO(epenner): This should probably be moved to output surface. 63 // TODO(epenner): This should probably be moved to output surface.
66 // 64 //
67 // This implements a simple fence based on client side swaps. 65 // This implements a simple fence based on client side swaps.
68 // This is to isolate the ResourceProvider from 'frames' which 66 // This is to isolate the ResourceProvider from 'frames' which
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 157
160 GLRenderer::GLRenderer(RendererClient* client, 158 GLRenderer::GLRenderer(RendererClient* client,
161 const LayerTreeSettings* settings, 159 const LayerTreeSettings* settings,
162 OutputSurface* output_surface, 160 OutputSurface* output_surface,
163 ResourceProvider* resource_provider, 161 ResourceProvider* resource_provider,
164 TextureMailboxDeleter* texture_mailbox_deleter, 162 TextureMailboxDeleter* texture_mailbox_deleter,
165 int highp_threshold_min) 163 int highp_threshold_min)
166 : DirectRenderer(client, settings, output_surface, resource_provider), 164 : DirectRenderer(client, settings, output_surface, resource_provider),
167 offscreen_framebuffer_id_(0), 165 offscreen_framebuffer_id_(0),
168 shared_geometry_quad_(gfx::RectF(-0.5f, -0.5f, 1.0f, 1.0f)), 166 shared_geometry_quad_(gfx::RectF(-0.5f, -0.5f, 1.0f, 1.0f)),
169 context_(output_surface->context_provider()->Context3d()),
170 gl_(output_surface->context_provider()->ContextGL()), 167 gl_(output_surface->context_provider()->ContextGL()),
171 context_support_(output_surface->context_provider()->ContextSupport()), 168 context_support_(output_surface->context_provider()->ContextSupport()),
172 texture_mailbox_deleter_(texture_mailbox_deleter), 169 texture_mailbox_deleter_(texture_mailbox_deleter),
173 is_backbuffer_discarded_(false), 170 is_backbuffer_discarded_(false),
174 visible_(true), 171 visible_(true),
175 is_scissor_enabled_(false), 172 is_scissor_enabled_(false),
176 scissor_rect_needs_reset_(true), 173 scissor_rect_needs_reset_(true),
177 stencil_shadow_(false), 174 stencil_shadow_(false),
178 blend_shadow_(false), 175 blend_shadow_(false),
179 highp_threshold_min_(highp_threshold_min), 176 highp_threshold_min_(highp_threshold_min),
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 pending_async_read_pixels_.pop_back(); 216 pending_async_read_pixels_.pop_back();
220 } 217 }
221 218
222 CleanupSharedObjects(); 219 CleanupSharedObjects();
223 } 220 }
224 221
225 const RendererCapabilities& GLRenderer::Capabilities() const { 222 const RendererCapabilities& GLRenderer::Capabilities() const {
226 return capabilities_; 223 return capabilities_;
227 } 224 }
228 225
229 WebGraphicsContext3D* GLRenderer::Context() { return context_; }
230
231 void GLRenderer::DebugGLCall(GLES2Interface* gl, 226 void GLRenderer::DebugGLCall(GLES2Interface* gl,
232 const char* command, 227 const char* command,
233 const char* file, 228 const char* file,
234 int line) { 229 int line) {
235 GLuint error = gl->GetError(); 230 GLuint error = gl->GetError();
236 if (error != GL_NO_ERROR) 231 if (error != GL_NO_ERROR)
237 LOG(ERROR) << "GL command failed: File: " << file << "\n\tLine " << line 232 LOG(ERROR) << "GL command failed: File: " << file << "\n\tLine " << line
238 << "\n\tcommand: " << command << ", error " 233 << "\n\tcommand: " << command << ", error "
239 << static_cast<int>(error) << "\n"; 234 << static_cast<int>(error) << "\n";
240 } 235 }
(...skipping 2767 matching lines...) Expand 10 before | Expand all | Expand 10 after
3008 is_scissor_enabled_ = false; 3003 is_scissor_enabled_ = false;
3009 GLC(gl_, gl_->Disable(GL_SCISSOR_TEST)); 3004 GLC(gl_, gl_->Disable(GL_SCISSOR_TEST));
3010 scissor_rect_needs_reset_ = true; 3005 scissor_rect_needs_reset_ = true;
3011 } 3006 }
3012 3007
3013 bool GLRenderer::IsContextLost() { 3008 bool GLRenderer::IsContextLost() {
3014 return output_surface_->context_provider()->IsContextLost(); 3009 return output_surface_->context_provider()->IsContextLost();
3015 } 3010 }
3016 3011
3017 } // namespace cc 3012 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698