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

Side by Side Diff: bench/SKPBench.cpp

Issue 1491823003: reset shader compilations for stats (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years 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 | src/gpu/GrGpu.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2014 Google Inc. 2 * Copyright 2014 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SKPBench.h" 8 #include "SKPBench.h"
9 #include "SkCommandLineFlags.h" 9 #include "SkCommandLineFlags.h"
10 #include "SkMultiPictureDraw.h" 10 #include "SkMultiPictureDraw.h"
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 -fTileRects[j].fTop / fScale) ; 150 -fTileRects[j].fTop / fScale) ;
151 fSurfaces[j]->getCanvas()->drawPicture(fPic, &trans, nullptr); 151 fSurfaces[j]->getCanvas()->drawPicture(fPic, &trans, nullptr);
152 } 152 }
153 153
154 for (int j = 0; j < fTileRects.count(); ++j) { 154 for (int j = 0; j < fTileRects.count(); ++j) {
155 fSurfaces[j]->getCanvas()->flush(); 155 fSurfaces[j]->getCanvas()->flush();
156 } 156 }
157 } 157 }
158 158
159 #if SK_SUPPORT_GPU 159 #if SK_SUPPORT_GPU
160 #include "GrGpu.h"
160 static void draw_pic_for_stats(SkCanvas* canvas, GrContext* context, const SkPic ture* picture, 161 static void draw_pic_for_stats(SkCanvas* canvas, GrContext* context, const SkPic ture* picture,
161 SkTArray<SkString>* keys, SkTArray<double>* value s, 162 SkTArray<SkString>* keys, SkTArray<double>* value s,
162 const char* tag) { 163 const char* tag) {
163 context->resetGpuStats(); 164 context->resetGpuStats();
164 canvas->drawPicture(picture); 165 canvas->drawPicture(picture);
165 canvas->flush(); 166 canvas->flush();
166 167
167 int offset = keys->count(); 168 int offset = keys->count();
168 context->dumpGpuStatsKeyValuePairs(keys, values); 169 context->dumpGpuStatsKeyValuePairs(keys, values);
169 170
170 // append tag, but only to new tags 171 // append tag, but only to new tags
171 for (int i = offset; i < keys->count(); i++, offset++) { 172 for (int i = offset; i < keys->count(); i++, offset++) {
172 (*keys)[i].appendf("_%s", tag); 173 (*keys)[i].appendf("_%s", tag);
173 } 174 }
174 } 175 }
175 #endif 176 #endif
176 177
177 void SKPBench::getGpuStats(SkCanvas* canvas, SkTArray<SkString>* keys, SkTArray< double>* values) { 178 void SKPBench::getGpuStats(SkCanvas* canvas, SkTArray<SkString>* keys, SkTArray< double>* values) {
178 #if SK_SUPPORT_GPU 179 #if SK_SUPPORT_GPU
179 // we do a special single draw and then dump the key / value pairs 180 // we do a special single draw and then dump the key / value pairs
180 GrContext* context = canvas->getGrContext(); 181 GrContext* context = canvas->getGrContext();
181 if (!context) { 182 if (!context) {
182 return; 183 return;
183 } 184 }
184 185
185 // TODO refactor this out if we want to test other subclasses of skpbench 186 // TODO refactor this out if we want to test other subclasses of skpbench
186 context->flush(); 187 context->flush();
187 context->freeGpuResources(); 188 context->freeGpuResources();
188 context->resetContext(); 189 context->resetContext();
190 context->getGpu()->resetShaderCacheForTesting();
189 draw_pic_for_stats(canvas, context, fPic, keys, values, "first_frame"); 191 draw_pic_for_stats(canvas, context, fPic, keys, values, "first_frame");
190 192
191 // draw second frame 193 // draw second frame
192 draw_pic_for_stats(canvas, context, fPic, keys, values, "second_frame"); 194 draw_pic_for_stats(canvas, context, fPic, keys, values, "second_frame");
193 195
194 #endif 196 #endif
195 } 197 }
OLDNEW
« no previous file with comments | « no previous file | src/gpu/GrGpu.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698