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

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

Issue 79603002: ResourceProvider should be able to avoid allocating immutable textures. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 1 month 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
« no previous file with comments | « no previous file | cc/resources/resource_provider.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 598 matching lines...) Expand 10 before | Expand all | Expand 10 after
609 609
610 int top, right, bottom, left; 610 int top, right, bottom, left;
611 quad->background_filters.GetOutsets(&top, &right, &bottom, &left); 611 quad->background_filters.GetOutsets(&top, &right, &bottom, &left);
612 window_rect.Inset(-left, -top, -right, -bottom); 612 window_rect.Inset(-left, -top, -right, -bottom);
613 613
614 window_rect.Intersect( 614 window_rect.Intersect(
615 MoveFromDrawToWindowSpace(frame->current_render_pass->output_rect)); 615 MoveFromDrawToWindowSpace(frame->current_render_pass->output_rect));
616 616
617 scoped_ptr<ScopedResource> device_background_texture = 617 scoped_ptr<ScopedResource> device_background_texture =
618 ScopedResource::create(resource_provider_); 618 ScopedResource::create(resource_provider_);
619 if (!device_background_texture->Allocate(window_rect.size(), 619 // The TextureUsageFramebuffer hint makes ResourceProvider to avoid immutable
danakj 2013/11/21 00:20:41 s/to avoid/avoid/
620 ResourceProvider::TextureUsageAny, 620 // storage allocation (texStorage2DEXT) for this texture. copyTexImage2D fails
621 RGBA_8888)) { 621 // when called on a texture having immutable storage.
622 if (!device_background_texture->Allocate(
623 window_rect.size(),
624 ResourceProvider::TextureUsageFramebuffer,
625 RGBA_8888)) {
622 return scoped_ptr<ScopedResource>(); 626 return scoped_ptr<ScopedResource>();
623 } else { 627 } else {
624 ResourceProvider::ScopedWriteLockGL lock(resource_provider_, 628 ResourceProvider::ScopedWriteLockGL lock(resource_provider_,
625 device_background_texture->id()); 629 device_background_texture->id());
626 GetFramebufferTexture(lock.texture_id(), 630 GetFramebufferTexture(lock.texture_id(),
627 device_background_texture->format(), 631 device_background_texture->format(),
628 window_rect); 632 window_rect);
629 } 633 }
630 634
631 skia::RefPtr<SkImageFilter> filter = RenderSurfaceFilters::BuildImageFilter( 635 skia::RefPtr<SkImageFilter> filter = RenderSurfaceFilters::BuildImageFilter(
(...skipping 2316 matching lines...) Expand 10 before | Expand all | Expand 10 after
2948 // The Skia GPU backend requires a stencil buffer. See ReinitializeGrCanvas 2952 // The Skia GPU backend requires a stencil buffer. See ReinitializeGrCanvas
2949 // implementation. 2953 // implementation.
2950 return gr_context_ && context_->getContextAttributes().stencil; 2954 return gr_context_ && context_->getContextAttributes().stencil;
2951 } 2955 }
2952 2956
2953 bool GLRenderer::IsContextLost() { 2957 bool GLRenderer::IsContextLost() {
2954 return output_surface_->context_provider()->IsContextLost(); 2958 return output_surface_->context_provider()->IsContextLost();
2955 } 2959 }
2956 2960
2957 } // namespace cc 2961 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | cc/resources/resource_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698