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

Unified Diff: cc/output/gl_renderer.cc

Issue 1884553003: cc: optimize texture allocation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: cleanup Created 4 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/TestExpectations » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/output/gl_renderer.cc
diff --git a/cc/output/gl_renderer.cc b/cc/output/gl_renderer.cc
index 6a75674271e6921f2f0658f281f12aa86425776e..d8af04ee1b2d82ab307e695bffc706c015d58ed9 100644
--- a/cc/output/gl_renderer.cc
+++ b/cc/output/gl_renderer.cc
@@ -141,6 +141,16 @@ BlendMode BlendModeFromSkXfermode(SkXfermode::Mode mode) {
}
}
+void RoundUpToPow2(gfx::RectF* rect) {
+ int w, h;
danakj 2016/05/04 21:24:58 you're using ints here but it's a RectF.
Stephen White 2016/05/04 21:27:31 Yep. There are implicit casts in the comparisons a
+ for (w = 1; w < rect->width(); w *= 2) {
enne (OOO) 2016/05/04 21:32:22 If you're casting to ints here for performance, mi
Stephen White 2016/05/04 21:47:17 Cute! I don't really care about performance here;
+ }
+ for (h = 1; h < rect->height(); h *= 2) {
+ }
+ rect->set_width(w);
+ rect->set_height(h);
+}
+
// Smallest unit that impact anti-aliasing output. We use this to
// determine when anti-aliasing is unnecessary.
const float kAntiAliasingEpsilon = 1.0f / 1024.0f;
@@ -1032,6 +1042,9 @@ void GLRenderer::DrawRenderPassQuad(DrawingFrame* frame,
if (dst_rect.IsEmpty()) {
return;
}
+ // Expand dst_rect size to the nearest power of 2, in order to get
enne (OOO) 2016/05/04 21:32:22 Are there limits on the size that is supported her
Stephen White 2016/05/04 21:47:17 If you mean, will the allocation fail due to an in
+ // more cache hits in Skia's texture cache.
+ RoundUpToPow2(&dst_rect);
filter_image = ApplyImageFilter(
ScopedUseGrContext::Create(this, frame), resource_provider_, rect,
dst_rect, scale, std::move(filter), contents_texture);
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/TestExpectations » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698