diff options
author | enne@chromium.org <enne@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-06 21:29:24 +0000 |
---|---|---|
committer | enne@chromium.org <enne@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-06 21:29:24 +0000 |
commit | 2eeea2b3af3a75fd682fca39fc21423887539373 (patch) | |
tree | 8c67d7dc754c817dc501b5dbde929a78d92a28b0 /cc/output | |
parent | 48329446603c155f1b0c5394ac6c993e22e8af1c (diff) | |
download | chromium_src-2eeea2b3af3a75fd682fca39fc21423887539373.zip chromium_src-2eeea2b3af3a75fd682fca39fc21423887539373.tar.gz chromium_src-2eeea2b3af3a75fd682fca39fc21423887539373.tar.bz2 |
Remove direct-to-backbuffer Ganesh path
The usage of the GrContext in GLRenderer is getting in the way of
cleaning up the WebGraphicsContext3D usage in cc.
This path was good for trying out the Ganesh path, but was never really
used, available on all platforms, or compatible with ubercompositor.
Ganesh-to-tile is almost landed and so it seems like this can be safely
removed for the present.
BUG=none
TBR=sky
Review URL: https://codereview.chromium.org/98463008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@239261 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/output')
-rw-r--r-- | cc/output/gl_renderer.cc | 107 | ||||
-rw-r--r-- | cc/output/gl_renderer.h | 8 | ||||
-rw-r--r-- | cc/output/renderer_pixeltest.cc | 26 |
3 files changed, 6 insertions, 135 deletions
diff --git a/cc/output/gl_renderer.cc b/cc/output/gl_renderer.cc index 16bdd31..b82228a 100644 --- a/cc/output/gl_renderer.cc +++ b/cc/output/gl_renderer.cc @@ -148,8 +148,7 @@ scoped_ptr<GLRenderer> GLRenderer::Create( OutputSurface* output_surface, ResourceProvider* resource_provider, TextureMailboxDeleter* texture_mailbox_deleter, - int highp_threshold_min, - bool use_skia_gpu_backend) { + int highp_threshold_min) { scoped_ptr<GLRenderer> renderer(new GLRenderer(client, settings, output_surface, @@ -158,12 +157,6 @@ scoped_ptr<GLRenderer> GLRenderer::Create( highp_threshold_min)); if (!renderer->Initialize()) return scoped_ptr<GLRenderer>(); - if (use_skia_gpu_backend) { - renderer->InitializeGrContext(); - DCHECK(renderer->CanUseSkiaGPUBackend()) - << "Requested Skia GPU backend, but can't use it."; - } - return renderer.Pass(); } @@ -232,18 +225,6 @@ bool GLRenderer::Initialize() { return true; } -void GLRenderer::InitializeGrContext() { - skia::RefPtr<GrGLInterface> interface = skia::AdoptRef( - context_->createGrGLInterface()); - if (!interface) - return; - - gr_context_ = skia::AdoptRef(GrContext::Create( - kOpenGL_GrBackend, - reinterpret_cast<GrBackendContext>(interface.get()))); - ReinitializeGrCanvas(); -} - GLRenderer::~GLRenderer() { while (!pending_async_read_pixels_.empty()) { PendingAsyncReadPixels* pending_read = pending_async_read_pixels_.back(); @@ -297,10 +278,6 @@ void GLRenderer::SendManagedMemoryStats(size_t bytes_visible, void GLRenderer::ReleaseRenderPassTextures() { render_pass_textures_.clear(); } -void GLRenderer::ViewportChanged() { - ReinitializeGrCanvas(); -} - void GLRenderer::DiscardPixels(bool has_external_stencil_test, bool draw_rect_covers_full_surface) { if (has_external_stencil_test || !draw_rect_covers_full_surface || @@ -337,12 +314,8 @@ void GLRenderer::ClearFramebuffer(DrawingFrame* frame, #endif if (always_clear || frame->current_render_pass->has_transparent_background) { GLbitfield clear_bits = GL_COLOR_BUFFER_BIT; - // Only the Skia GPU backend uses the stencil buffer. No need to clear it - // otherwise. - if (always_clear || CanUseSkiaGPUBackend()) { - GLC(context_, context_->clearStencil(0)); + if (always_clear) clear_bits |= GL_STENCIL_BUFFER_BIT; - } context_->clear(clear_bits); } } @@ -355,6 +328,7 @@ void GLRenderer::BeginDrawingFrame(DrawingFrame* frame) { MakeContextCurrent(); + // TODO(enne): Do we need to reinitialize all of this state per frame? ReinitializeGLState(); } @@ -1776,57 +1750,8 @@ void GLRenderer::DrawStreamVideoQuad(const DrawingFrame* frame, program->vertex_shader().matrix_location()); } -void GLRenderer::DrawPictureQuadDirectToBackbuffer( - const DrawingFrame* frame, - const PictureDrawQuad* quad) { - DCHECK(CanUseSkiaGPUBackend()); - DCHECK_EQ(quad->opacity(), 1.f) << "Need to composite to a bitmap or a " - "render surface for non-1 opacity quads"; - - // TODO(enne): This should be done more lazily / efficiently. - gr_context_->resetContext(); - - // Reset the canvas matrix to identity because the clip rect is in target - // space. - SkMatrix sk_identity; - sk_identity.setIdentity(); - sk_canvas_->setMatrix(sk_identity); - - if (is_scissor_enabled_) { - sk_canvas_->clipRect(gfx::RectToSkRect(scissor_rect_), - SkRegion::kReplace_Op); - } else { - sk_canvas_->clipRect(gfx::RectToSkRect(client_->DeviceViewport()), - SkRegion::kReplace_Op); - } - - gfx::Transform contents_device_transform = frame->window_matrix * - frame->projection_matrix * quad->quadTransform(); - contents_device_transform.Translate(quad->rect.x(), - quad->rect.y()); - contents_device_transform.FlattenTo2d(); - SkMatrix sk_device_matrix; - gfx::TransformToFlattenedSkMatrix(contents_device_transform, - &sk_device_matrix); - sk_canvas_->setMatrix(sk_device_matrix); - - quad->picture_pile->RasterDirect( - sk_canvas_.get(), quad->content_rect, quad->contents_scale, NULL); - - // Flush any drawing buffers that have been deferred. - sk_canvas_->flush(); - - // TODO(enne): This should be done more lazily / efficiently. - ReinitializeGLState(); -} - void GLRenderer::DrawPictureQuad(const DrawingFrame* frame, const PictureDrawQuad* quad) { - if (quad->can_draw_direct_to_backbuffer && CanUseSkiaGPUBackend()) { - DrawPictureQuadDirectToBackbuffer(frame, quad); - return; - } - if (on_demand_tile_raster_bitmap_.width() != quad->texture_size.width() || on_demand_tile_raster_bitmap_.height() != quad->texture_size.height()) { on_demand_tile_raster_bitmap_.setConfig( @@ -3137,26 +3062,6 @@ void GLRenderer::CleanupSharedObjects() { ReleaseRenderPassTextures(); } -void GLRenderer::ReinitializeGrCanvas() { - if (!CanUseSkiaGPUBackend()) - return; - - GrBackendRenderTargetDesc desc; - desc.fWidth = client_->DeviceViewport().width(); - desc.fHeight = client_->DeviceViewport().height(); - desc.fConfig = kRGBA_8888_GrPixelConfig; - desc.fOrigin = kTopLeft_GrSurfaceOrigin; - desc.fSampleCnt = 1; - desc.fStencilBits = 8; - desc.fRenderTargetHandle = 0; - - skia::RefPtr<GrSurface> surface( - skia::AdoptRef(gr_context_->wrapBackendRenderTarget(desc))); - skia::RefPtr<SkBaseDevice> device( - skia::AdoptRef(SkGpuDevice::Create(surface.get()))); - sk_canvas_ = skia::AdoptRef(new SkCanvas(device.get())); -} - void GLRenderer::ReinitializeGLState() { // Bind the common vertex attributes used for drawing all the layers. shared_geometry_->PrepareForDraw(); @@ -3178,12 +3083,6 @@ void GLRenderer::ReinitializeGLState() { scissor_rect_needs_reset_ = true; } -bool GLRenderer::CanUseSkiaGPUBackend() const { - // The Skia GPU backend requires a stencil buffer. See ReinitializeGrCanvas - // implementation. - return gr_context_ && context_->getContextAttributes().stencil; -} - bool GLRenderer::IsContextLost() { return output_surface_->context_provider()->IsContextLost(); } diff --git a/cc/output/gl_renderer.h b/cc/output/gl_renderer.h index 8d95262..85c0fa1 100644 --- a/cc/output/gl_renderer.h +++ b/cc/output/gl_renderer.h @@ -47,8 +47,7 @@ class CC_EXPORT GLRenderer : public DirectRenderer { OutputSurface* output_surface, ResourceProvider* resource_provider, TextureMailboxDeleter* texture_mailbox_deleter, - int highp_threshold_min, - bool use_skia_gpu_backend); + int highp_threshold_min); virtual ~GLRenderer(); @@ -56,8 +55,6 @@ class CC_EXPORT GLRenderer : public DirectRenderer { blink::WebGraphicsContext3D* Context(); - virtual void ViewportChanged() OVERRIDE; - // Waits for rendering to finish. virtual void Finish() OVERRIDE; @@ -79,8 +76,6 @@ class CC_EXPORT GLRenderer : public DirectRenderer { const char* file, int line); - bool CanUseSkiaGPUBackend() const; - protected: GLRenderer(RendererClient* client, const LayerTreeSettings* settings, @@ -220,7 +215,6 @@ class CC_EXPORT GLRenderer : public DirectRenderer { scoped_ptr<CopyOutputRequest> request, bool success); - void ReinitializeGrCanvas(); void ReinitializeGLState(); virtual void DiscardBackbuffer() OVERRIDE; diff --git a/cc/output/renderer_pixeltest.cc b/cc/output/renderer_pixeltest.cc index 2bf5152..23190c3 100644 --- a/cc/output/renderer_pixeltest.cc +++ b/cc/output/renderer_pixeltest.cc @@ -147,16 +147,6 @@ typedef ::testing::Types<GLRenderer, SoftwareRendererWithExpandedViewport> RendererTypes; TYPED_TEST_CASE(RendererPixelTest, RendererTypes); -typedef ::testing::Types<GLRenderer, - GLRendererWithSkiaGPUBackend, - SoftwareRenderer> RendererTypesWithSkiaGPUBackend; -template <typename RendererType> -class RendererPixelTestWithSkiaGPUBackend - : public RendererPixelTest<RendererType> { -}; -TYPED_TEST_CASE(RendererPixelTestWithSkiaGPUBackend, - RendererTypesWithSkiaGPUBackend); - // All pixels can be off by one, but any more than that is an error. class FuzzyPixelOffByOneComparator : public FuzzyPixelComparator { public: @@ -1625,10 +1615,9 @@ TEST_F(GLRendererPixelTest, AntiAliasingPerspective) { FuzzyPixelOffByOneComparator(true))); } -TYPED_TEST(RendererPixelTestWithSkiaGPUBackend, PictureDrawQuadIdentityScale) { +TYPED_TEST(RendererPixelTest, PictureDrawQuadIdentityScale) { gfx::Size pile_tile_size(1000, 1000); gfx::Rect viewport(this->device_viewport_size_); - bool use_skia_gpu_backend = this->UseSkiaGPUBackend(); // TODO(enne): the renderer should figure this out on its own. ResourceFormat texture_format = RGBA_8888; @@ -1671,7 +1660,6 @@ TYPED_TEST(RendererPixelTestWithSkiaGPUBackend, PictureDrawQuadIdentityScale) { texture_format, viewport, 1.f, - use_skia_gpu_backend, blue_pile); pass->quad_list.push_back(blue_quad.PassAs<DrawQuad>()); @@ -1696,7 +1684,6 @@ TYPED_TEST(RendererPixelTestWithSkiaGPUBackend, PictureDrawQuadIdentityScale) { texture_format, viewport, 1.f, - use_skia_gpu_backend, green_pile); pass->quad_list.push_back(green_quad.PassAs<DrawQuad>()); @@ -1714,7 +1701,6 @@ TYPED_TEST(RendererPixelTestWithSkiaGPUBackend, PictureDrawQuadIdentityScale) { TYPED_TEST(RendererPixelTest, PictureDrawQuadOpacity) { gfx::Size pile_tile_size(1000, 1000); gfx::Rect viewport(this->device_viewport_size_); - bool use_skia_gpu_backend = this->UseSkiaGPUBackend(); ResourceFormat texture_format = RGBA_8888; RenderPass::Id id(1, 1); @@ -1744,7 +1730,6 @@ TYPED_TEST(RendererPixelTest, PictureDrawQuadOpacity) { texture_format, viewport, 1.f, - use_skia_gpu_backend, green_pile); pass->quad_list.push_back(green_quad.PassAs<DrawQuad>()); @@ -1769,7 +1754,6 @@ TYPED_TEST(RendererPixelTest, PictureDrawQuadOpacity) { texture_format, viewport, 1.f, - use_skia_gpu_backend, white_pile); pass->quad_list.push_back(white_quad.PassAs<DrawQuad>()); @@ -1807,7 +1791,6 @@ TYPED_TEST(RendererPixelTest, PictureDrawQuadDisableImageFiltering) { gfx::Size pile_tile_size(1000, 1000); gfx::Rect viewport(this->device_viewport_size_); - bool use_skia_gpu_backend = this->UseSkiaGPUBackend(); ResourceFormat texture_format = RGBA_8888; RenderPass::Id id(1, 1); @@ -1847,7 +1830,6 @@ TYPED_TEST(RendererPixelTest, PictureDrawQuadDisableImageFiltering) { texture_format, viewport, 1.f, - use_skia_gpu_backend, pile); pass->quad_list.push_back(quad.PassAs<DrawQuad>()); @@ -1863,11 +1845,10 @@ TYPED_TEST(RendererPixelTest, PictureDrawQuadDisableImageFiltering) { ExactPixelComparator(true))); } -TYPED_TEST(RendererPixelTestWithSkiaGPUBackend, +TYPED_TEST(RendererPixelTest, PictureDrawQuadNonIdentityScale) { gfx::Size pile_tile_size(1000, 1000); gfx::Rect viewport(this->device_viewport_size_); - bool use_skia_gpu_backend = this->UseSkiaGPUBackend(); // TODO(enne): the renderer should figure this out on its own. ResourceFormat texture_format = RGBA_8888; @@ -1906,7 +1887,6 @@ TYPED_TEST(RendererPixelTestWithSkiaGPUBackend, texture_format, green_rect1, 1.f, - use_skia_gpu_backend, green_pile); pass->quad_list.push_back(green_quad1.PassAs<DrawQuad>()); @@ -1919,7 +1899,6 @@ TYPED_TEST(RendererPixelTestWithSkiaGPUBackend, texture_format, green_rect2, 1.f, - use_skia_gpu_backend, green_pile); pass->quad_list.push_back(green_quad2.PassAs<DrawQuad>()); @@ -1991,7 +1970,6 @@ TYPED_TEST(RendererPixelTestWithSkiaGPUBackend, texture_format, content_union_rect, contents_scale, - use_skia_gpu_backend, pile); pass->quad_list.push_back(blue_quad.PassAs<DrawQuad>()); |