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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | tools/lua/paths_agg.lua » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 --
2 -- Copyright 2014 Google Inc.
3 --
4 -- Use of this source code is governed by a BSD-style license that can be
5 -- found in the LICENSE file.
6 --
7
8 -- Path scraping script.
9 -- This script is designed to count the number of times we fall back to software
10 -- rendering for a path in a given SKP. However, this script does not count an e xact
11 -- number of uploads, since there is some overlap with clipping: e.g. two clippe d paths
12 -- may cause three uploads to the GPU (set clip 1, set clip 2, unset clip 2/rese t clip 1),
13 -- but these cases are rare.
14
15 draws = 0
16 drawPaths = 0
17 drawPathsAnti = 0
18 drawPathsConvexAnti = 0
19
20 clips = 0
21 clipPaths = 0
22 clipPathsAnti = 0
23 clipPathsConvexAnti = 0
24
25 usedPath = false
26 usedSWPath = false
27
28 skpsTotal = 0
29 skpsWithPath = 0
30 skpsWithSWPath = 0
31
32 function sk_scrape_startcanvas(c, fileName)
33 usedPath = false
34 usedSWPath = false
35 end
36
37 function sk_scrape_endcanvas(c, fileName)
38 skpsTotal = skpsTotal + 1
39 if usedPath then
40 skpsWithPath = skpsWithPath + 1
41 if usedSWPath then
42 skpsWithSWPath = skpsWithSWPath + 1
43 end
44 end
45 end
46
47 function string.starts(String,Start)
48 return string.sub(String,1,string.len(Start))==Start
49 end
50
51 function isPathValid(path)
52 if not path then
53 return false
54 end
55
56 if path:isEmpty() then
57 return false
58 end
59
60 if path:isRect() then
61 return false
62 end
63
64 return true
65 end
66
67 function sk_scrape_accumulate(t)
68 if (string.starts(t.verb, "draw")) then
69 draws = draws + 1
70 end
71
72 if (string.starts(t.verb, "clip")) then
73 clips = clips + 1
74 end
75
76 if t.verb == "clipPath" then
77 local path = t.path
78 if isPathValid(path) then
79 clipPaths = clipPaths + 1
80 usedPath = true
81 if t.aa then
82 clipPathsAnti = clipPathsAnti + 1
83 if path:isConvex() then
84 clipPathsConvexAnti = clipPathsConvexAnti + 1
85 else
86 usedSWPath = true
87 end
88 end
89 end
90 end
91
92 if t.verb == "drawPath" then
93 local path = t.path
94 local paint = t.paint
95 if paint and isPathValid(path) then
96 drawPaths = drawPaths + 1
97 usedPath = true
98 if paint:isAntiAlias() then
99 drawPathsAnti = drawPathsAnti + 1
100 if path:isConvex() then
101 drawPathsConvexAnti = drawPathsConvexAnti + 1
102 else
103 usedSWPath = true
104 end
105 end
106 end
107 end
108 end
109
110 function sk_scrape_summarize()
111 local swDrawPaths = drawPathsAnti - drawPathsConvexAnti
112 local swClipPaths = clipPathsAnti - clipPathsConvexAnti
113
114 io.write("clips = clips + ", clips, "\n");
115 io.write("draws = draws + ", draws, "\n");
116 io.write("clipPaths = clipPaths + ", clipPaths, "\n");
117 io.write("drawPaths = drawPaths + ", drawPaths, "\n");
118 io.write("swClipPaths = swClipPaths + ", swClipPaths, "\n");
119 io.write("swDrawPaths = swDrawPaths + ", swDrawPaths, "\n");
120
121 io.write("skpsTotal = skpsTotal + ", skpsTotal, "\n");
122 io.write("skpsWithPath = skpsWithPath + ", skpsWithPath, "\n");
123 io.write("skpsWithSWPath = skpsWithSWPath + ", skpsWithSWPath, "\n");
124 end
OLDNEW
« 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