OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 /* | 8 /* |
9 * Code for the "gm" (Golden Master) rendering comparison tool. | 9 * Code for the "gm" (Golden Master) rendering comparison tool. |
10 * | 10 * |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 #include "SkGpuDevice.h" | 58 #include "SkGpuDevice.h" |
59 typedef GrContextFactory::GLContextType GLContextType; | 59 typedef GrContextFactory::GLContextType GLContextType; |
60 #define DEFAULT_CACHE_VALUE -1 | 60 #define DEFAULT_CACHE_VALUE -1 |
61 static int gGpuCacheSizeBytes; | 61 static int gGpuCacheSizeBytes; |
62 static int gGpuCacheSizeCount; | 62 static int gGpuCacheSizeCount; |
63 #else | 63 #else |
64 class GrContextFactory; | 64 class GrContextFactory; |
65 class GrContext; | 65 class GrContext; |
66 class GrSurface; | 66 class GrSurface; |
67 typedef int GLContextType; | 67 typedef int GLContextType; |
| 68 typedef int GrGLStandard; |
68 #endif | 69 #endif |
69 | 70 |
70 #define DEBUGFAIL_SEE_STDERR SkDEBUGFAIL("see stderr for message") | 71 #define DEBUGFAIL_SEE_STDERR SkDEBUGFAIL("see stderr for message") |
71 | 72 |
72 DECLARE_bool(useDocumentInsteadOfDevice); | 73 DECLARE_bool(useDocumentInsteadOfDevice); |
73 | 74 |
74 #ifdef SK_SUPPORT_PDF | 75 #ifdef SK_SUPPORT_PDF |
75 #include "SkPDFDevice.h" | 76 #include "SkPDFDevice.h" |
76 #include "SkPDFDocument.h" | 77 #include "SkPDFDocument.h" |
77 #endif | 78 #endif |
(...skipping 1256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1334 #endif | 1335 #endif |
1335 #ifdef SK_BUILD_NATIVE_PDF_RENDERER | 1336 #ifdef SK_BUILD_NATIVE_PDF_RENDERER |
1336 { &SkNativeRasterizePDF, "native", true }, | 1337 { &SkNativeRasterizePDF, "native", true }, |
1337 #endif // SK_BUILD_NATIVE_PDF_RENDERER | 1338 #endif // SK_BUILD_NATIVE_PDF_RENDERER |
1338 // The following exists so that this array is never zero length. | 1339 // The following exists so that this array is never zero length. |
1339 { &SkNoRasterizePDF, "none", false}, | 1340 { &SkNoRasterizePDF, "none", false}, |
1340 }; | 1341 }; |
1341 | 1342 |
1342 static const char kDefaultsConfigStr[] = "defaults"; | 1343 static const char kDefaultsConfigStr[] = "defaults"; |
1343 static const char kExcludeConfigChar = '~'; | 1344 static const char kExcludeConfigChar = '~'; |
| 1345 #if SK_SUPPORT_GPU |
| 1346 static const char kGpuApiNameGL[] = "gl"; |
| 1347 static const char kGpuApiNameGLES[] = "gles"; |
| 1348 #endif |
1344 | 1349 |
1345 static SkString configUsage() { | 1350 static SkString configUsage() { |
1346 SkString result; | 1351 SkString result; |
1347 result.appendf("Space delimited list of which configs to run. Possible optio
ns: ["); | 1352 result.appendf("Space delimited list of which configs to run. Possible optio
ns: ["); |
1348 for (size_t i = 0; i < SK_ARRAY_COUNT(gRec); ++i) { | 1353 for (size_t i = 0; i < SK_ARRAY_COUNT(gRec); ++i) { |
1349 SkASSERT(gRec[i].fName != kDefaultsConfigStr); | 1354 SkASSERT(gRec[i].fName != kDefaultsConfigStr); |
1350 if (i > 0) { | 1355 if (i > 0) { |
1351 result.append("|"); | 1356 result.append("|"); |
1352 } | 1357 } |
1353 result.appendf("%s", gRec[i].fName); | 1358 result.appendf("%s", gRec[i].fName); |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1423 #define TOSTRING(x) TOSTRING_INTERNAL(x) | 1428 #define TOSTRING(x) TOSTRING_INTERNAL(x) |
1424 | 1429 |
1425 // Alphabetized ignoring "no" prefix ("readPath", "noreplay", "resourcePath"). | 1430 // Alphabetized ignoring "no" prefix ("readPath", "noreplay", "resourcePath"). |
1426 DEFINE_string(config, "", configUsage().c_str()); | 1431 DEFINE_string(config, "", configUsage().c_str()); |
1427 DEFINE_string(pdfRasterizers, "default", pdfRasterizerUsage().c_str()); | 1432 DEFINE_string(pdfRasterizers, "default", pdfRasterizerUsage().c_str()); |
1428 DEFINE_bool(deferred, false, "Exercise the deferred rendering test pass."); | 1433 DEFINE_bool(deferred, false, "Exercise the deferred rendering test pass."); |
1429 DEFINE_bool(dryRun, false, "Don't actually run the tests, just print what would
have been done."); | 1434 DEFINE_bool(dryRun, false, "Don't actually run the tests, just print what would
have been done."); |
1430 DEFINE_string(excludeConfig, "", "Space delimited list of configs to skip."); | 1435 DEFINE_string(excludeConfig, "", "Space delimited list of configs to skip."); |
1431 DEFINE_bool(forceBWtext, false, "Disable text anti-aliasing."); | 1436 DEFINE_bool(forceBWtext, false, "Disable text anti-aliasing."); |
1432 #if SK_SUPPORT_GPU | 1437 #if SK_SUPPORT_GPU |
| 1438 DEFINE_string(forceGpuApi, "", "Force use of specific gpu API. Using \"gl\" " |
| 1439 "forces OpenGL API. Using \"gles\" forces OpenGL ES API. " |
| 1440 "Defaults to empty string, which selects the API native to the " |
| 1441 "system."); |
1433 DEFINE_string(gpuCacheSize, "", "<bytes> <count>: Limit the gpu cache to byte si
ze or " | 1442 DEFINE_string(gpuCacheSize, "", "<bytes> <count>: Limit the gpu cache to byte si
ze or " |
1434 "object count. " TOSTRING(DEFAULT_CACHE_VALUE) " for either value
means " | 1443 "object count. " TOSTRING(DEFAULT_CACHE_VALUE) " for either value
means " |
1435 "use the default. 0 for either disables the cache."); | 1444 "use the default. 0 for either disables the cache."); |
1436 #endif | 1445 #endif |
1437 DEFINE_bool(hierarchy, false, "Whether to use multilevel directory structure " | 1446 DEFINE_bool(hierarchy, false, "Whether to use multilevel directory structure " |
1438 "when reading/writing files."); | 1447 "when reading/writing files."); |
1439 DEFINE_string(ignoreErrorTypes, kDefaultIgnorableErrorTypes.asString(" ").c_str(
), | 1448 DEFINE_string(ignoreErrorTypes, kDefaultIgnorableErrorTypes.asString(" ").c_str(
), |
1440 "Space-separated list of ErrorTypes that should be ignored. If any
*other* error " | 1449 "Space-separated list of ErrorTypes that should be ignored. If any
*other* error " |
1441 "types are encountered, the tool will exit with a nonzero return v
alue."); | 1450 "types are encountered, the tool will exit with a nonzero return v
alue."); |
1442 DEFINE_string(ignoreFailuresFile, "", "Path to file containing a list of tests f
or which we " | 1451 DEFINE_string(ignoreFailuresFile, "", "Path to file containing a list of tests f
or which we " |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1704 * Run this test in a number of different configs (8888, 565, PDF, | 1713 * Run this test in a number of different configs (8888, 565, PDF, |
1705 * etc.), confirming that the resulting bitmaps match expectations | 1714 * etc.), confirming that the resulting bitmaps match expectations |
1706 * (which may be different for each config). | 1715 * (which may be different for each config). |
1707 * | 1716 * |
1708 * Returns all errors encountered while doing so. | 1717 * Returns all errors encountered while doing so. |
1709 */ | 1718 */ |
1710 ErrorCombination run_multiple_configs(GMMain &gmmain, GM *gm, | 1719 ErrorCombination run_multiple_configs(GMMain &gmmain, GM *gm, |
1711 const SkTDArray<size_t> &configs, | 1720 const SkTDArray<size_t> &configs, |
1712 const SkTDArray<const PDFRasterizerData*>
&pdfRasterizers, | 1721 const SkTDArray<const PDFRasterizerData*>
&pdfRasterizers, |
1713 const SkTDArray<SkScalar> &tileGridReplayS
cales, | 1722 const SkTDArray<SkScalar> &tileGridReplayS
cales, |
1714 GrContextFactory *grFactory); | 1723 GrContextFactory *grFactory, |
| 1724 GrGLStandard forcedGpuApi); |
1715 ErrorCombination run_multiple_configs(GMMain &gmmain, GM *gm, | 1725 ErrorCombination run_multiple_configs(GMMain &gmmain, GM *gm, |
1716 const SkTDArray<size_t> &configs, | 1726 const SkTDArray<size_t> &configs, |
1717 const SkTDArray<const PDFRasterizerData*>
&pdfRasterizers, | 1727 const SkTDArray<const PDFRasterizerData*>
&pdfRasterizers, |
1718 const SkTDArray<SkScalar> &tileGridReplayS
cales, | 1728 const SkTDArray<SkScalar> &tileGridReplayS
cales, |
1719 GrContextFactory *grFactory) { | 1729 GrContextFactory *grFactory, |
| 1730 GrGLStandard forcedGpuApi) { |
1720 const char renderModeDescriptor[] = ""; | 1731 const char renderModeDescriptor[] = ""; |
1721 ErrorCombination errorsForAllConfigs; | 1732 ErrorCombination errorsForAllConfigs; |
1722 uint32_t gmFlags = gm->getFlags(); | 1733 uint32_t gmFlags = gm->getFlags(); |
1723 | 1734 |
1724 for (int i = 0; i < configs.count(); i++) { | 1735 for (int i = 0; i < configs.count(); i++) { |
1725 ConfigData config = gRec[configs[i]]; | 1736 ConfigData config = gRec[configs[i]]; |
1726 const SkString shortNamePlusConfig = gmmain.make_shortname_plus_config(g
m->getName(), | 1737 const SkString shortNamePlusConfig = gmmain.make_shortname_plus_config(g
m->getName(), |
1727 c
onfig.fName); | 1738 c
onfig.fName); |
1728 | 1739 |
1729 // Skip any tests that we don't even need to try. | 1740 // Skip any tests that we don't even need to try. |
(...skipping 29 matching lines...) Expand all Loading... |
1759 // Now we know that we want to run this test and record its | 1770 // Now we know that we want to run this test and record its |
1760 // success or failure. | 1771 // success or failure. |
1761 ErrorCombination errorsForThisConfig; | 1772 ErrorCombination errorsForThisConfig; |
1762 GrSurface* gpuTarget = NULL; | 1773 GrSurface* gpuTarget = NULL; |
1763 #if SK_SUPPORT_GPU | 1774 #if SK_SUPPORT_GPU |
1764 SkAutoTUnref<GrSurface> auGpuTarget; | 1775 SkAutoTUnref<GrSurface> auGpuTarget; |
1765 if ((errorsForThisConfig.isEmpty()) && (kGPU_Backend == config.fBackend)
) { | 1776 if ((errorsForThisConfig.isEmpty()) && (kGPU_Backend == config.fBackend)
) { |
1766 if (FLAGS_resetGpuContext) { | 1777 if (FLAGS_resetGpuContext) { |
1767 grFactory->destroyContexts(); | 1778 grFactory->destroyContexts(); |
1768 } | 1779 } |
1769 GrContext* gr = grFactory->get(config.fGLContextType); | 1780 GrContext* gr = grFactory->get(config.fGLContextType, forcedGpuApi); |
1770 bool grSuccess = false; | 1781 bool grSuccess = false; |
1771 if (gr) { | 1782 if (gr) { |
1772 // create a render target to back the device | 1783 // create a render target to back the device |
1773 GrTextureDesc desc; | 1784 GrTextureDesc desc; |
1774 desc.fConfig = kSkia8888_GrPixelConfig; | 1785 desc.fConfig = kSkia8888_GrPixelConfig; |
1775 desc.fFlags = kRenderTarget_GrTextureFlagBit; | 1786 desc.fFlags = kRenderTarget_GrTextureFlagBit; |
1776 desc.fWidth = gm->getISize().width(); | 1787 desc.fWidth = gm->getISize().width(); |
1777 desc.fHeight = gm->getISize().height(); | 1788 desc.fHeight = gm->getISize().height(); |
1778 desc.fSampleCnt = config.fSampleCnt; | 1789 desc.fSampleCnt = config.fSampleCnt; |
1779 auGpuTarget.reset(gr->createUncachedTexture(desc, NULL, 0)); | 1790 auGpuTarget.reset(gr->createUncachedTexture(desc, NULL, 0)); |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1930 return false; | 1941 return false; |
1931 } | 1942 } |
1932 } | 1943 } |
1933 } | 1944 } |
1934 } | 1945 } |
1935 } | 1946 } |
1936 return true; | 1947 return true; |
1937 } | 1948 } |
1938 | 1949 |
1939 static bool parse_flags_configs(SkTDArray<size_t>* outConfigs, | 1950 static bool parse_flags_configs(SkTDArray<size_t>* outConfigs, |
1940 GrContextFactory* grFactory) { | 1951 GrContextFactory* grFactory, GrGLStandard forcedGpuApi)
{ |
1941 SkTDArray<size_t> excludeConfigs; | 1952 SkTDArray<size_t> excludeConfigs; |
1942 | 1953 |
1943 for (int i = 0; i < FLAGS_config.count(); i++) { | 1954 for (int i = 0; i < FLAGS_config.count(); i++) { |
1944 const char* config = FLAGS_config[i]; | 1955 const char* config = FLAGS_config[i]; |
1945 bool exclude = false; | 1956 bool exclude = false; |
1946 if (*config == kExcludeConfigChar) { | 1957 if (*config == kExcludeConfigChar) { |
1947 exclude = true; | 1958 exclude = true; |
1948 config += 1; | 1959 config += 1; |
1949 } | 1960 } |
1950 int index = findConfig(config); | 1961 int index = findConfig(config); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1997 // now assert that there was only one copy in configs[] | 2008 // now assert that there was only one copy in configs[] |
1998 SkASSERT(outConfigs->find(excludeConfigs[i]) < 0); | 2009 SkASSERT(outConfigs->find(excludeConfigs[i]) < 0); |
1999 } | 2010 } |
2000 } | 2011 } |
2001 | 2012 |
2002 #if SK_SUPPORT_GPU | 2013 #if SK_SUPPORT_GPU |
2003 SkASSERT(grFactory != NULL); | 2014 SkASSERT(grFactory != NULL); |
2004 for (int i = 0; i < outConfigs->count(); ++i) { | 2015 for (int i = 0; i < outConfigs->count(); ++i) { |
2005 size_t index = (*outConfigs)[i]; | 2016 size_t index = (*outConfigs)[i]; |
2006 if (kGPU_Backend == gRec[index].fBackend) { | 2017 if (kGPU_Backend == gRec[index].fBackend) { |
2007 GrContext* ctx = grFactory->get(gRec[index].fGLContextType); | 2018 GrContext* ctx = grFactory->get(gRec[index].fGLContextType, forcedGp
uApi); |
2008 if (NULL == ctx) { | 2019 if (NULL == ctx) { |
2009 SkDebugf("GrContext could not be created for config %s. Config w
ill be skipped.\n", | 2020 SkDebugf("GrContext could not be created for config %s. Config w
ill be skipped.\n", |
2010 gRec[index].fName); | 2021 gRec[index].fName); |
2011 outConfigs->remove(i); | 2022 outConfigs->remove(i); |
2012 --i; | 2023 --i; |
2013 continue; | 2024 continue; |
2014 } | 2025 } |
2015 if (gRec[index].fSampleCnt > ctx->getMaxSampleCount()) { | 2026 if (gRec[index].fSampleCnt > ctx->getMaxSampleCount()) { |
2016 SkDebugf("Sample count (%d) of config %s is not supported." | 2027 SkDebugf("Sample count (%d) of config %s is not supported." |
2017 " Config will be skipped.\n", | 2028 " Config will be skipped.\n", |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2151 return false; | 2162 return false; |
2152 } | 2163 } |
2153 *sizeBytes = atoi(FLAGS_gpuCacheSize[0]); | 2164 *sizeBytes = atoi(FLAGS_gpuCacheSize[0]); |
2154 *sizeCount = atoi(FLAGS_gpuCacheSize[1]); | 2165 *sizeCount = atoi(FLAGS_gpuCacheSize[1]); |
2155 } else { | 2166 } else { |
2156 *sizeBytes = DEFAULT_CACHE_VALUE; | 2167 *sizeBytes = DEFAULT_CACHE_VALUE; |
2157 *sizeCount = DEFAULT_CACHE_VALUE; | 2168 *sizeCount = DEFAULT_CACHE_VALUE; |
2158 } | 2169 } |
2159 return true; | 2170 return true; |
2160 } | 2171 } |
| 2172 |
| 2173 static bool parse_flags_gpu_api(GrGLStandard* forcedGpuApi) { |
| 2174 if (0 == FLAGS_forceGpuApi.count()) { |
| 2175 *forcedGpuApi = kNone_GrGLStandard; |
| 2176 return true; |
| 2177 } |
| 2178 if (1 == FLAGS_forceGpuApi.count()) { |
| 2179 if (strcmp(FLAGS_forceGpuApi[0], kGpuApiNameGL) == 0) { |
| 2180 *forcedGpuApi = kGL_GrGLStandard; |
| 2181 return true; |
| 2182 } else if (strcmp(FLAGS_forceGpuApi[0], kGpuApiNameGLES) == 0) { |
| 2183 *forcedGpuApi = kGLES_GrGLStandard; |
| 2184 return true; |
| 2185 } |
| 2186 } |
| 2187 SkDebugf("--forceGpuApi invalid api value"); |
| 2188 return false; |
| 2189 } |
2161 #endif | 2190 #endif |
2162 | 2191 |
2163 static bool parse_flags_tile_grid_replay_scales(SkTDArray<SkScalar>* outScales)
{ | 2192 static bool parse_flags_tile_grid_replay_scales(SkTDArray<SkScalar>* outScales)
{ |
2164 *outScales->append() = SK_Scalar1; // By default only test at scale 1.0 | 2193 *outScales->append() = SK_Scalar1; // By default only test at scale 1.0 |
2165 if (FLAGS_tileGridReplayScales.count() > 0) { | 2194 if (FLAGS_tileGridReplayScales.count() > 0) { |
2166 outScales->reset(); | 2195 outScales->reset(); |
2167 for (int i = 0; i < FLAGS_tileGridReplayScales.count(); i++) { | 2196 for (int i = 0; i < FLAGS_tileGridReplayScales.count(); i++) { |
2168 double val = atof(FLAGS_tileGridReplayScales[i]); | 2197 double val = atof(FLAGS_tileGridReplayScales[i]); |
2169 if (0 < val) { | 2198 if (0 < val) { |
2170 *outScales->append() = SkDoubleToScalar(val); | 2199 *outScales->append() = SkDoubleToScalar(val); |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2249 setSystemPreferences(); | 2278 setSystemPreferences(); |
2250 GMMain gmmain; | 2279 GMMain gmmain; |
2251 | 2280 |
2252 SkTDArray<size_t> configs; | 2281 SkTDArray<size_t> configs; |
2253 | 2282 |
2254 int moduloRemainder = -1; | 2283 int moduloRemainder = -1; |
2255 int moduloDivisor = -1; | 2284 int moduloDivisor = -1; |
2256 SkTDArray<const PDFRasterizerData*> pdfRasterizers; | 2285 SkTDArray<const PDFRasterizerData*> pdfRasterizers; |
2257 SkTDArray<SkScalar> tileGridReplayScales; | 2286 SkTDArray<SkScalar> tileGridReplayScales; |
2258 #if SK_SUPPORT_GPU | 2287 #if SK_SUPPORT_GPU |
| 2288 GrGLStandard forcedGpuApi = kNone_GrGLStandard; |
2259 GrContextFactory* grFactory = new GrContextFactory; | 2289 GrContextFactory* grFactory = new GrContextFactory; |
2260 #else | 2290 #else |
| 2291 GrGLStandard forcedGpuApi = 0; |
2261 GrContextFactory* grFactory = NULL; | 2292 GrContextFactory* grFactory = NULL; |
2262 #endif | 2293 #endif |
2263 | 2294 |
2264 if (FLAGS_dryRun) { | 2295 if (FLAGS_dryRun) { |
2265 SkDebugf( "Doing a dry run; no tests will actually be executed.\n"); | 2296 SkDebugf( "Doing a dry run; no tests will actually be executed.\n"); |
2266 } | 2297 } |
2267 | 2298 |
2268 if (!parse_flags_modulo(&moduloRemainder, &moduloDivisor) || | 2299 if (!parse_flags_modulo(&moduloRemainder, &moduloDivisor) || |
2269 !parse_flags_ignore_error_types(&gmmain.fIgnorableErrorTypes) || | 2300 !parse_flags_ignore_error_types(&gmmain.fIgnorableErrorTypes) || |
2270 !parse_flags_ignore_tests(gmmain.fIgnorableTestNames) || | 2301 !parse_flags_ignore_tests(gmmain.fIgnorableTestNames) || |
2271 #if SK_SUPPORT_GPU | 2302 #if SK_SUPPORT_GPU |
2272 !parse_flags_gpu_cache(&gGpuCacheSizeBytes, &gGpuCacheSizeCount) || | 2303 !parse_flags_gpu_cache(&gGpuCacheSizeBytes, &gGpuCacheSizeCount) || |
| 2304 !parse_flags_gpu_api(&forcedGpuApi) || |
2273 #endif | 2305 #endif |
2274 !parse_flags_tile_grid_replay_scales(&tileGridReplayScales) || | 2306 !parse_flags_tile_grid_replay_scales(&tileGridReplayScales) || |
2275 !parse_flags_resource_path() || | 2307 !parse_flags_resource_path() || |
2276 !parse_flags_jpeg_quality() || | 2308 !parse_flags_jpeg_quality() || |
2277 !parse_flags_configs(&configs, grFactory) || | 2309 !parse_flags_configs(&configs, grFactory, forcedGpuApi) || |
2278 !parse_flags_pdf_rasterizers(configs, &pdfRasterizers) || | 2310 !parse_flags_pdf_rasterizers(configs, &pdfRasterizers) || |
2279 !parse_flags_gmmain_paths(&gmmain)) { | 2311 !parse_flags_gmmain_paths(&gmmain)) { |
2280 return -1; | 2312 return -1; |
2281 } | 2313 } |
2282 | 2314 |
2283 if (FLAGS_verbose) { | 2315 if (FLAGS_verbose) { |
2284 if (FLAGS_writePath.count() == 1) { | 2316 if (FLAGS_writePath.count() == 1) { |
2285 SkDebugf("writing to %s\n", FLAGS_writePath[0]); | 2317 SkDebugf("writing to %s\n", FLAGS_writePath[0]); |
2286 } | 2318 } |
2287 if (NULL != gmmain.fMismatchPath) { | 2319 if (NULL != gmmain.fMismatchPath) { |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2349 | 2381 |
2350 if (SkCommandLineFlags::ShouldSkip(FLAGS_match, shortName)) { | 2382 if (SkCommandLineFlags::ShouldSkip(FLAGS_match, shortName)) { |
2351 continue; | 2383 continue; |
2352 } | 2384 } |
2353 | 2385 |
2354 gmsRun++; | 2386 gmsRun++; |
2355 SkISize size = gm->getISize(); | 2387 SkISize size = gm->getISize(); |
2356 SkDebugf("%sdrawing... %s [%d %d]\n", moduloStr.c_str(), shortName, | 2388 SkDebugf("%sdrawing... %s [%d %d]\n", moduloStr.c_str(), shortName, |
2357 size.width(), size.height()); | 2389 size.width(), size.height()); |
2358 if (!FLAGS_dryRun) | 2390 if (!FLAGS_dryRun) |
2359 run_multiple_configs(gmmain, gm, configs, pdfRasterizers, tileGridRe
playScales, grFactory); | 2391 run_multiple_configs(gmmain, gm, configs, pdfRasterizers, tileGridRe
playScales, |
| 2392 grFactory, forcedGpuApi); |
2360 } | 2393 } |
2361 | 2394 |
2362 if (FLAGS_dryRun) | 2395 if (FLAGS_dryRun) |
2363 return 0; | 2396 return 0; |
2364 | 2397 |
2365 SkTArray<SkString> modes; | 2398 SkTArray<SkString> modes; |
2366 gmmain.GetRenderModesEncountered(modes); | 2399 gmmain.GetRenderModesEncountered(modes); |
2367 int modeCount = modes.count(); | 2400 int modeCount = modes.count(); |
2368 | 2401 |
2369 // Now that we have run all the tests and thus know the full set of renderMo
des that we | 2402 // Now that we have run all the tests and thus know the full set of renderMo
des that we |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2428 } | 2461 } |
2429 #endif | 2462 #endif |
2430 | 2463 |
2431 #if SK_SUPPORT_GPU | 2464 #if SK_SUPPORT_GPU |
2432 | 2465 |
2433 #if GR_CACHE_STATS | 2466 #if GR_CACHE_STATS |
2434 for (int i = 0; i < configs.count(); i++) { | 2467 for (int i = 0; i < configs.count(); i++) { |
2435 ConfigData config = gRec[configs[i]]; | 2468 ConfigData config = gRec[configs[i]]; |
2436 | 2469 |
2437 if (FLAGS_verbose && (kGPU_Backend == config.fBackend)) { | 2470 if (FLAGS_verbose && (kGPU_Backend == config.fBackend)) { |
2438 GrContext* gr = grFactory->get(config.fGLContextType); | 2471 GrContext* gr = grFactory->get(config.fGLContextType, forcedGpuApi); |
2439 | 2472 |
2440 SkDebugf("config: %s %x\n", config.fName, gr); | 2473 SkDebugf("config: %s %x\n", config.fName, gr); |
2441 gr->printCacheStats(); | 2474 gr->printCacheStats(); |
2442 } | 2475 } |
2443 } | 2476 } |
2444 #endif | 2477 #endif |
2445 | 2478 |
2446 #if GR_DUMP_FONT_CACHE | 2479 #if GR_DUMP_FONT_CACHE |
2447 for (int i = 0; i < configs.count(); i++) { | 2480 for (int i = 0; i < configs.count(); i++) { |
2448 ConfigData config = gRec[configs[i]]; | 2481 ConfigData config = gRec[configs[i]]; |
2449 | 2482 |
2450 if (kGPU_Backend == config.fBackend) { | 2483 if (kGPU_Backend == config.fBackend) { |
2451 GrContext* gr = grFactory->get(config.fGLContextType); | 2484 GrContext* gr = grFactory->get(config.fGLContextType, forcedGpuApi); |
2452 | 2485 |
2453 gr->dumpFontCache(); | 2486 gr->dumpFontCache(); |
2454 } | 2487 } |
2455 } | 2488 } |
2456 #endif | 2489 #endif |
2457 | 2490 |
2458 delete grFactory; | 2491 delete grFactory; |
2459 #endif | 2492 #endif |
2460 SkGraphics::Term(); | 2493 SkGraphics::Term(); |
2461 | 2494 |
2462 return (reportError) ? -1 : 0; | 2495 return (reportError) ? -1 : 0; |
2463 } | 2496 } |
2464 | 2497 |
2465 void GMMain::installFilter(SkCanvas* canvas) { | 2498 void GMMain::installFilter(SkCanvas* canvas) { |
2466 if (FLAGS_forceBWtext) { | 2499 if (FLAGS_forceBWtext) { |
2467 canvas->setDrawFilter(SkNEW(BWTextDrawFilter))->unref(); | 2500 canvas->setDrawFilter(SkNEW(BWTextDrawFilter))->unref(); |
2468 } | 2501 } |
2469 } | 2502 } |
2470 | 2503 |
2471 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) | 2504 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) |
2472 int main(int argc, char * const argv[]) { | 2505 int main(int argc, char * const argv[]) { |
2473 return tool_main(argc, (char**) argv); | 2506 return tool_main(argc, (char**) argv); |
2474 } | 2507 } |
2475 #endif | 2508 #endif |
OLD | NEW |