OLD | NEW |
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 <ctype.h> | 8 #include <ctype.h> |
9 | 9 |
10 #include "Benchmark.h" | 10 #include "Benchmark.h" |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 t->surface.reset(code); \ | 212 t->surface.reset(code); \ |
213 targets->push(t); \ | 213 targets->push(t); \ |
214 } | 214 } |
215 if (FLAGS_cpu) { | 215 if (FLAGS_cpu) { |
216 CPU_TARGET(nonrendering, kNonRendering_Backend, NULL) | 216 CPU_TARGET(nonrendering, kNonRendering_Backend, NULL) |
217 CPU_TARGET(8888, kRaster_Backend, SkSurface::NewRaster(_8888)) | 217 CPU_TARGET(8888, kRaster_Backend, SkSurface::NewRaster(_8888)) |
218 CPU_TARGET(565, kRaster_Backend, SkSurface::NewRaster(_565)) | 218 CPU_TARGET(565, kRaster_Backend, SkSurface::NewRaster(_565)) |
219 } | 219 } |
220 | 220 |
221 #if SK_SUPPORT_GPU | 221 #if SK_SUPPORT_GPU |
222 if (FLAGS_resetGpuContext) { | |
223 gGrFactory.destroyContexts(); | |
224 } | |
225 | 222 |
226 #define GPU_TARGET(config, ctxType, info, samples)
\ | 223 #define GPU_TARGET(config, ctxType, info, samples)
\ |
227 if (Target* t = is_enabled(bench, Benchmark::kGPU_Backend, #config)) {
\ | 224 if (Target* t = is_enabled(bench, Benchmark::kGPU_Backend, #config)) {
\ |
228 t->surface.reset(SkSurface::NewRenderTarget(gGrFactory.get(ctxType),
info, samples)); \ | 225 t->surface.reset(SkSurface::NewRenderTarget(gGrFactory.get(ctxType),
info, samples)); \ |
229 t->gl = gGrFactory.getGLContext(ctxType);
\ | 226 t->gl = gGrFactory.getGLContext(ctxType);
\ |
230 targets->push(t);
\ | 227 targets->push(t);
\ |
231 } | 228 } |
232 if (FLAGS_gpu) { | 229 if (FLAGS_gpu) { |
233 GPU_TARGET(gpu, GrContextFactory::kNative_GLContextType, _8888, 0) | 230 GPU_TARGET(gpu, GrContextFactory::kNative_GLContextType, _8888, 0) |
234 GPU_TARGET(msaa4, GrContextFactory::kNative_GLContextType, _8888, 4) | 231 GPU_TARGET(msaa4, GrContextFactory::kNative_GLContextType, _8888, 4) |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
353 , humanize(stats.mean).c_str() | 350 , humanize(stats.mean).c_str() |
354 , humanize(stats.max).c_str() | 351 , humanize(stats.max).c_str() |
355 , stddev_percent | 352 , stddev_percent |
356 , stats.plot.c_str() | 353 , stats.plot.c_str() |
357 , config | 354 , config |
358 , bench->getName() | 355 , bench->getName() |
359 ); | 356 ); |
360 } | 357 } |
361 } | 358 } |
362 targets.deleteAll(); | 359 targets.deleteAll(); |
| 360 |
| 361 #if SK_SUPPORT_GPU |
| 362 if (FLAGS_resetGpuContext) { |
| 363 gGrFactory.destroyContexts(); |
| 364 } |
| 365 #endif |
363 } | 366 } |
364 | 367 |
365 return 0; | 368 return 0; |
366 } | 369 } |
367 | 370 |
368 #if !defined SK_BUILD_FOR_IOS | 371 #if !defined SK_BUILD_FOR_IOS |
369 int main(int argc, char * const argv[]) { | 372 int main(int argc, char * const argv[]) { |
370 return tool_main(argc, (char**) argv); | 373 return tool_main(argc, (char**) argv); |
371 } | 374 } |
372 #endif | 375 #endif |
OLD | NEW |