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

Unified Diff: tools/lua/paths.lua

Issue 475433004: Add scraper to find paths that fallback to software (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Count SKPs per canvas not per invocation Created 6 years, 4 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 | tools/lua/paths_agg.lua » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/lua/paths.lua
diff --git a/tools/lua/paths.lua b/tools/lua/paths.lua
new file mode 100644
index 0000000000000000000000000000000000000000..0fa65288e1ccd91bd7f5cbaf3adc098e3cc1a9ee
--- /dev/null
+++ b/tools/lua/paths.lua
@@ -0,0 +1,124 @@
+--
+-- Copyright 2014 Google Inc.
+--
+-- Use of this source code is governed by a BSD-style license that can be
+-- found in the LICENSE file.
+--
+
+-- Path scraping script.
+-- This script is designed to count the number of times we fall back to software
+-- rendering for a path in a given SKP. However, this script does not count an exact
+-- number of uploads, since there is some overlap with clipping: e.g. two clipped paths
+-- may cause three uploads to the GPU (set clip 1, set clip 2, unset clip 2/reset clip 1),
+-- but these cases are rare.
+
+draws = 0
+drawPaths = 0
+drawPathsAnti = 0
+drawPathsConvexAnti = 0
+
+clips = 0
+clipPaths = 0
+clipPathsAnti = 0
+clipPathsConvexAnti = 0
+
+usedPath = false
+usedSWPath = false
+
+skpsTotal = 0
+skpsWithPath = 0
+skpsWithSWPath = 0
+
+function sk_scrape_startcanvas(c, fileName)
+ usedPath = false
+ usedSWPath = false
+end
+
+function sk_scrape_endcanvas(c, fileName)
+ skpsTotal = skpsTotal + 1
+ if usedPath then
+ skpsWithPath = skpsWithPath + 1
+ if usedSWPath then
+ skpsWithSWPath = skpsWithSWPath + 1
+ end
+ end
+end
+
+function string.starts(String,Start)
+ return string.sub(String,1,string.len(Start))==Start
+end
+
+function isPathValid(path)
+ if not path then
+ return false
+ end
+
+ if path:isEmpty() then
+ return false
+ end
+
+ if path:isRect() then
+ return false
+ end
+
+ return true
+end
+
+function sk_scrape_accumulate(t)
+ if (string.starts(t.verb, "draw")) then
+ draws = draws + 1
+ end
+
+ if (string.starts(t.verb, "clip")) then
+ clips = clips + 1
+ end
+
+ if t.verb == "clipPath" then
+ local path = t.path
+ if isPathValid(path) then
+ clipPaths = clipPaths + 1
+ usedPath = true
+ if t.aa then
+ clipPathsAnti = clipPathsAnti + 1
+ if path:isConvex() then
+ clipPathsConvexAnti = clipPathsConvexAnti + 1
+ else
+ usedSWPath = true
+ end
+ end
+ end
+ end
+
+ if t.verb == "drawPath" then
+ local path = t.path
+ local paint = t.paint
+ if paint and isPathValid(path) then
+ drawPaths = drawPaths + 1
+ usedPath = true
+ if paint:isAntiAlias() then
+ drawPathsAnti = drawPathsAnti + 1
+ if path:isConvex() then
+ drawPathsConvexAnti = drawPathsConvexAnti + 1
+ else
+ usedSWPath = true
+ end
+ end
+ end
+ end
+end
+
+function sk_scrape_summarize()
+ local swDrawPaths = drawPathsAnti - drawPathsConvexAnti
+ local swClipPaths = clipPathsAnti - clipPathsConvexAnti
+
+ io.write("clips = clips + ", clips, "\n");
+ io.write("draws = draws + ", draws, "\n");
+ io.write("clipPaths = clipPaths + ", clipPaths, "\n");
+ io.write("drawPaths = drawPaths + ", drawPaths, "\n");
+ io.write("swClipPaths = swClipPaths + ", swClipPaths, "\n");
+ io.write("swDrawPaths = swDrawPaths + ", swDrawPaths, "\n");
+
+ io.write("skpsTotal = skpsTotal + ", skpsTotal, "\n");
+ io.write("skpsWithPath = skpsWithPath + ", skpsWithPath, "\n");
+ io.write("skpsWithSWPath = skpsWithSWPath + ", skpsWithSWPath, "\n");
+end
« no previous file with comments | « no previous file | tools/lua/paths_agg.lua » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698