| 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 #include "SkGpuDevice.h" | 60 #include "SkGpuDevice.h" |
| 61 typedef GrContextFactory::GLContextType GLContextType; | 61 typedef GrContextFactory::GLContextType GLContextType; |
| 62 #define DEFAULT_CACHE_VALUE -1 | 62 #define DEFAULT_CACHE_VALUE -1 |
| 63 static int gGpuCacheSizeBytes; | 63 static int gGpuCacheSizeBytes; |
| 64 static int gGpuCacheSizeCount; | 64 static int gGpuCacheSizeCount; |
| 65 #else | 65 #else |
| 66 class GrContextFactory; | 66 class GrContextFactory; |
| 67 class GrContext; | 67 class GrContext; |
| 68 class GrSurface; | 68 class GrSurface; |
| 69 typedef int GLContextType; | 69 typedef int GLContextType; |
| 70 typedef int GrGLStandard; | |
| 71 #endif | 70 #endif |
| 72 | 71 |
| 73 #define DEBUGFAIL_SEE_STDERR SkDEBUGFAIL("see stderr for message") | 72 #define DEBUGFAIL_SEE_STDERR SkDEBUGFAIL("see stderr for message") |
| 74 | 73 |
| 75 DECLARE_bool(useDocumentInsteadOfDevice); | 74 DECLARE_bool(useDocumentInsteadOfDevice); |
| 76 | 75 |
| 77 #ifdef SK_SUPPORT_PDF | 76 #ifdef SK_SUPPORT_PDF |
| 78 #include "SkPDFDevice.h" | 77 #include "SkPDFDevice.h" |
| 79 #include "SkPDFDocument.h" | 78 #include "SkPDFDocument.h" |
| 80 #endif | 79 #endif |
| (...skipping 1248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1329 #endif | 1328 #endif |
| 1330 #ifdef SK_BUILD_NATIVE_PDF_RENDERER | 1329 #ifdef SK_BUILD_NATIVE_PDF_RENDERER |
| 1331 { &SkNativeRasterizePDF, "native", true }, | 1330 { &SkNativeRasterizePDF, "native", true }, |
| 1332 #endif // SK_BUILD_NATIVE_PDF_RENDERER | 1331 #endif // SK_BUILD_NATIVE_PDF_RENDERER |
| 1333 // The following exists so that this array is never zero length. | 1332 // The following exists so that this array is never zero length. |
| 1334 { &SkNoRasterizePDF, "none", false}, | 1333 { &SkNoRasterizePDF, "none", false}, |
| 1335 }; | 1334 }; |
| 1336 | 1335 |
| 1337 static const char kDefaultsConfigStr[] = "defaults"; | 1336 static const char kDefaultsConfigStr[] = "defaults"; |
| 1338 static const char kExcludeConfigChar = '~'; | 1337 static const char kExcludeConfigChar = '~'; |
| 1339 #if SK_SUPPORT_GPU | |
| 1340 static const char kGpuAPINameGL[] = "gl"; | |
| 1341 static const char kGpuAPINameGLES[] = "gles"; | |
| 1342 #endif | |
| 1343 | 1338 |
| 1344 static SkString configUsage() { | 1339 static SkString configUsage() { |
| 1345 SkString result; | 1340 SkString result; |
| 1346 result.appendf("Space delimited list of which configs to run. Possible optio
ns: ["); | 1341 result.appendf("Space delimited list of which configs to run. Possible optio
ns: ["); |
| 1347 for (size_t i = 0; i < SK_ARRAY_COUNT(gRec); ++i) { | 1342 for (size_t i = 0; i < SK_ARRAY_COUNT(gRec); ++i) { |
| 1348 SkASSERT(gRec[i].fName != kDefaultsConfigStr); | 1343 SkASSERT(gRec[i].fName != kDefaultsConfigStr); |
| 1349 if (i > 0) { | 1344 if (i > 0) { |
| 1350 result.append("|"); | 1345 result.append("|"); |
| 1351 } | 1346 } |
| 1352 result.appendf("%s", gRec[i].fName); | 1347 result.appendf("%s", gRec[i].fName); |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1422 #define TOSTRING(x) TOSTRING_INTERNAL(x) | 1417 #define TOSTRING(x) TOSTRING_INTERNAL(x) |
| 1423 | 1418 |
| 1424 // Alphabetized ignoring "no" prefix ("readPath", "noreplay", "resourcePath"). | 1419 // Alphabetized ignoring "no" prefix ("readPath", "noreplay", "resourcePath"). |
| 1425 DEFINE_string(config, "", configUsage().c_str()); | 1420 DEFINE_string(config, "", configUsage().c_str()); |
| 1426 DEFINE_string(pdfRasterizers, "default", pdfRasterizerUsage().c_str()); | 1421 DEFINE_string(pdfRasterizers, "default", pdfRasterizerUsage().c_str()); |
| 1427 DEFINE_bool(deferred, false, "Exercise the deferred rendering test pass."); | 1422 DEFINE_bool(deferred, false, "Exercise the deferred rendering test pass."); |
| 1428 DEFINE_bool(dryRun, false, "Don't actually run the tests, just print what would
have been done."); | 1423 DEFINE_bool(dryRun, false, "Don't actually run the tests, just print what would
have been done."); |
| 1429 DEFINE_string(excludeConfig, "", "Space delimited list of configs to skip."); | 1424 DEFINE_string(excludeConfig, "", "Space delimited list of configs to skip."); |
| 1430 DEFINE_bool(forceBWtext, false, "Disable text anti-aliasing."); | 1425 DEFINE_bool(forceBWtext, false, "Disable text anti-aliasing."); |
| 1431 #if SK_SUPPORT_GPU | 1426 #if SK_SUPPORT_GPU |
| 1432 DEFINE_string(gpuAPI, "", "Force use of specific gpu API. Using \"gl\" " | |
| 1433 "forces OpenGL API. Using \"gles\" forces OpenGL ES API. " | |
| 1434 "Defaults to empty string, which selects the API native to the " | |
| 1435 "system."); | |
| 1436 DEFINE_string(gpuCacheSize, "", "<bytes> <count>: Limit the gpu cache to byte si
ze or " | 1427 DEFINE_string(gpuCacheSize, "", "<bytes> <count>: Limit the gpu cache to byte si
ze or " |
| 1437 "object count. " TOSTRING(DEFAULT_CACHE_VALUE) " for either value
means " | 1428 "object count. " TOSTRING(DEFAULT_CACHE_VALUE) " for either value
means " |
| 1438 "use the default. 0 for either disables the cache."); | 1429 "use the default. 0 for either disables the cache."); |
| 1439 #endif | 1430 #endif |
| 1440 DEFINE_bool(hierarchy, false, "Whether to use multilevel directory structure " | 1431 DEFINE_bool(hierarchy, false, "Whether to use multilevel directory structure " |
| 1441 "when reading/writing files."); | 1432 "when reading/writing files."); |
| 1442 DEFINE_string(ignoreErrorTypes, kDefaultIgnorableErrorTypes.asString(" ").c_str(
), | 1433 DEFINE_string(ignoreErrorTypes, kDefaultIgnorableErrorTypes.asString(" ").c_str(
), |
| 1443 "Space-separated list of ErrorTypes that should be ignored. If any
*other* error " | 1434 "Space-separated list of ErrorTypes that should be ignored. If any
*other* error " |
| 1444 "types are encountered, the tool will exit with a nonzero return v
alue."); | 1435 "types are encountered, the tool will exit with a nonzero return v
alue."); |
| 1445 DEFINE_string(ignoreFailuresFile, "", "Path to file containing a list of tests f
or which we " | 1436 DEFINE_string(ignoreFailuresFile, "", "Path to file containing a list of tests f
or which we " |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1703 * Run this test in a number of different configs (8888, 565, PDF, | 1694 * Run this test in a number of different configs (8888, 565, PDF, |
| 1704 * etc.), confirming that the resulting bitmaps match expectations | 1695 * etc.), confirming that the resulting bitmaps match expectations |
| 1705 * (which may be different for each config). | 1696 * (which may be different for each config). |
| 1706 * | 1697 * |
| 1707 * Returns all errors encountered while doing so. | 1698 * Returns all errors encountered while doing so. |
| 1708 */ | 1699 */ |
| 1709 ErrorCombination run_multiple_configs(GMMain &gmmain, GM *gm, | 1700 ErrorCombination run_multiple_configs(GMMain &gmmain, GM *gm, |
| 1710 const SkTDArray<size_t> &configs, | 1701 const SkTDArray<size_t> &configs, |
| 1711 const SkTDArray<const PDFRasterizerData*>
&pdfRasterizers, | 1702 const SkTDArray<const PDFRasterizerData*>
&pdfRasterizers, |
| 1712 const SkTDArray<SkScalar> &tileGridReplayS
cales, | 1703 const SkTDArray<SkScalar> &tileGridReplayS
cales, |
| 1713 GrContextFactory *grFactory, | 1704 GrContextFactory *grFactory); |
| 1714 GrGLStandard gpuAPI); | |
| 1715 ErrorCombination run_multiple_configs(GMMain &gmmain, GM *gm, | 1705 ErrorCombination run_multiple_configs(GMMain &gmmain, GM *gm, |
| 1716 const SkTDArray<size_t> &configs, | 1706 const SkTDArray<size_t> &configs, |
| 1717 const SkTDArray<const PDFRasterizerData*>
&pdfRasterizers, | 1707 const SkTDArray<const PDFRasterizerData*>
&pdfRasterizers, |
| 1718 const SkTDArray<SkScalar> &tileGridReplayS
cales, | 1708 const SkTDArray<SkScalar> &tileGridReplayS
cales, |
| 1719 GrContextFactory *grFactory, | 1709 GrContextFactory *grFactory) { |
| 1720 GrGLStandard gpuAPI) { | |
| 1721 const char renderModeDescriptor[] = ""; | 1710 const char renderModeDescriptor[] = ""; |
| 1722 ErrorCombination errorsForAllConfigs; | 1711 ErrorCombination errorsForAllConfigs; |
| 1723 uint32_t gmFlags = gm->getFlags(); | 1712 uint32_t gmFlags = gm->getFlags(); |
| 1724 | 1713 |
| 1725 for (int i = 0; i < configs.count(); i++) { | 1714 for (int i = 0; i < configs.count(); i++) { |
| 1726 ConfigData config = gRec[configs[i]]; | 1715 ConfigData config = gRec[configs[i]]; |
| 1727 const SkString shortNamePlusConfig = gmmain.make_shortname_plus_config(g
m->getName(), | 1716 const SkString shortNamePlusConfig = gmmain.make_shortname_plus_config(g
m->getName(), |
| 1728 c
onfig.fName); | 1717 c
onfig.fName); |
| 1729 | 1718 |
| 1730 // Skip any tests that we don't even need to try. | 1719 // Skip any tests that we don't even need to try. |
| (...skipping 29 matching lines...) Expand all Loading... |
| 1760 // Now we know that we want to run this test and record its | 1749 // Now we know that we want to run this test and record its |
| 1761 // success or failure. | 1750 // success or failure. |
| 1762 ErrorCombination errorsForThisConfig; | 1751 ErrorCombination errorsForThisConfig; |
| 1763 GrSurface* gpuTarget = NULL; | 1752 GrSurface* gpuTarget = NULL; |
| 1764 #if SK_SUPPORT_GPU | 1753 #if SK_SUPPORT_GPU |
| 1765 SkAutoTUnref<GrSurface> auGpuTarget; | 1754 SkAutoTUnref<GrSurface> auGpuTarget; |
| 1766 if ((errorsForThisConfig.isEmpty()) && (kGPU_Backend == config.fBackend)
) { | 1755 if ((errorsForThisConfig.isEmpty()) && (kGPU_Backend == config.fBackend)
) { |
| 1767 if (FLAGS_resetGpuContext) { | 1756 if (FLAGS_resetGpuContext) { |
| 1768 grFactory->destroyContexts(); | 1757 grFactory->destroyContexts(); |
| 1769 } | 1758 } |
| 1770 GrContext* gr = grFactory->get(config.fGLContextType, gpuAPI); | 1759 GrContext* gr = grFactory->get(config.fGLContextType); |
| 1771 bool grSuccess = false; | 1760 bool grSuccess = false; |
| 1772 if (gr) { | 1761 if (gr) { |
| 1773 // create a render target to back the device | 1762 // create a render target to back the device |
| 1774 GrTextureDesc desc; | 1763 GrTextureDesc desc; |
| 1775 desc.fConfig = kSkia8888_GrPixelConfig; | 1764 desc.fConfig = kSkia8888_GrPixelConfig; |
| 1776 desc.fFlags = kRenderTarget_GrTextureFlagBit; | 1765 desc.fFlags = kRenderTarget_GrTextureFlagBit; |
| 1777 desc.fWidth = gm->getISize().width(); | 1766 desc.fWidth = gm->getISize().width(); |
| 1778 desc.fHeight = gm->getISize().height(); | 1767 desc.fHeight = gm->getISize().height(); |
| 1779 desc.fSampleCnt = config.fSampleCnt; | 1768 desc.fSampleCnt = config.fSampleCnt; |
| 1780 auGpuTarget.reset(gr->createUncachedTexture(desc, NULL, 0)); | 1769 auGpuTarget.reset(gr->createUncachedTexture(desc, NULL, 0)); |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1931 return false; | 1920 return false; |
| 1932 } | 1921 } |
| 1933 } | 1922 } |
| 1934 } | 1923 } |
| 1935 } | 1924 } |
| 1936 } | 1925 } |
| 1937 return true; | 1926 return true; |
| 1938 } | 1927 } |
| 1939 | 1928 |
| 1940 static bool parse_flags_configs(SkTDArray<size_t>* outConfigs, | 1929 static bool parse_flags_configs(SkTDArray<size_t>* outConfigs, |
| 1941 GrContextFactory* grFactory, GrGLStandard gpuAPI) { | 1930 GrContextFactory* grFactory) { |
| 1942 SkTDArray<size_t> excludeConfigs; | 1931 SkTDArray<size_t> excludeConfigs; |
| 1943 | 1932 |
| 1944 for (int i = 0; i < FLAGS_config.count(); i++) { | 1933 for (int i = 0; i < FLAGS_config.count(); i++) { |
| 1945 const char* config = FLAGS_config[i]; | 1934 const char* config = FLAGS_config[i]; |
| 1946 bool exclude = false; | 1935 bool exclude = false; |
| 1947 if (*config == kExcludeConfigChar) { | 1936 if (*config == kExcludeConfigChar) { |
| 1948 exclude = true; | 1937 exclude = true; |
| 1949 config += 1; | 1938 config += 1; |
| 1950 } | 1939 } |
| 1951 int index = findConfig(config); | 1940 int index = findConfig(config); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1998 // now assert that there was only one copy in configs[] | 1987 // now assert that there was only one copy in configs[] |
| 1999 SkASSERT(outConfigs->find(excludeConfigs[i]) < 0); | 1988 SkASSERT(outConfigs->find(excludeConfigs[i]) < 0); |
| 2000 } | 1989 } |
| 2001 } | 1990 } |
| 2002 | 1991 |
| 2003 #if SK_SUPPORT_GPU | 1992 #if SK_SUPPORT_GPU |
| 2004 SkASSERT(grFactory != NULL); | 1993 SkASSERT(grFactory != NULL); |
| 2005 for (int i = 0; i < outConfigs->count(); ++i) { | 1994 for (int i = 0; i < outConfigs->count(); ++i) { |
| 2006 size_t index = (*outConfigs)[i]; | 1995 size_t index = (*outConfigs)[i]; |
| 2007 if (kGPU_Backend == gRec[index].fBackend) { | 1996 if (kGPU_Backend == gRec[index].fBackend) { |
| 2008 GrContext* ctx = grFactory->get(gRec[index].fGLContextType, gpuAPI); | 1997 GrContext* ctx = grFactory->get(gRec[index].fGLContextType); |
| 2009 if (NULL == ctx) { | 1998 if (NULL == ctx) { |
| 2010 SkDebugf("GrContext could not be created for config %s. Config w
ill be skipped.\n", | 1999 SkDebugf("GrContext could not be created for config %s. Config w
ill be skipped.\n", |
| 2011 gRec[index].fName); | 2000 gRec[index].fName); |
| 2012 outConfigs->remove(i); | 2001 outConfigs->remove(i); |
| 2013 --i; | 2002 --i; |
| 2014 continue; | 2003 continue; |
| 2015 } | 2004 } |
| 2016 if (gRec[index].fSampleCnt > ctx->getMaxSampleCount()) { | 2005 if (gRec[index].fSampleCnt > ctx->getMaxSampleCount()) { |
| 2017 SkDebugf("Sample count (%d) of config %s is not supported." | 2006 SkDebugf("Sample count (%d) of config %s is not supported." |
| 2018 " Config will be skipped.\n", | 2007 " Config will be skipped.\n", |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2152 return false; | 2141 return false; |
| 2153 } | 2142 } |
| 2154 *sizeBytes = atoi(FLAGS_gpuCacheSize[0]); | 2143 *sizeBytes = atoi(FLAGS_gpuCacheSize[0]); |
| 2155 *sizeCount = atoi(FLAGS_gpuCacheSize[1]); | 2144 *sizeCount = atoi(FLAGS_gpuCacheSize[1]); |
| 2156 } else { | 2145 } else { |
| 2157 *sizeBytes = DEFAULT_CACHE_VALUE; | 2146 *sizeBytes = DEFAULT_CACHE_VALUE; |
| 2158 *sizeCount = DEFAULT_CACHE_VALUE; | 2147 *sizeCount = DEFAULT_CACHE_VALUE; |
| 2159 } | 2148 } |
| 2160 return true; | 2149 return true; |
| 2161 } | 2150 } |
| 2162 | |
| 2163 static bool parse_flags_gl_standard(GrGLStandard* gpuAPI) { | |
| 2164 if (0 == FLAGS_gpuAPI.count()) { | |
| 2165 *gpuAPI = kNone_GrGLStandard; | |
| 2166 return true; | |
| 2167 } | |
| 2168 if (1 == FLAGS_gpuAPI.count()) { | |
| 2169 if (FLAGS_gpuAPI.contains(kGpuAPINameGL)) { | |
| 2170 *gpuAPI = kGL_GrGLStandard; | |
| 2171 return true; | |
| 2172 } | |
| 2173 if (FLAGS_gpuAPI.contains(kGpuAPINameGLES)) { | |
| 2174 *gpuAPI = kGLES_GrGLStandard; | |
| 2175 return true; | |
| 2176 } | |
| 2177 } | |
| 2178 SkDebugf("--gpuAPI invalid api value"); | |
| 2179 return false; | |
| 2180 } | |
| 2181 #endif | 2151 #endif |
| 2182 | 2152 |
| 2183 static bool parse_flags_tile_grid_replay_scales(SkTDArray<SkScalar>* outScales)
{ | 2153 static bool parse_flags_tile_grid_replay_scales(SkTDArray<SkScalar>* outScales)
{ |
| 2184 *outScales->append() = SK_Scalar1; // By default only test at scale 1.0 | 2154 *outScales->append() = SK_Scalar1; // By default only test at scale 1.0 |
| 2185 if (FLAGS_tileGridReplayScales.count() > 0) { | 2155 if (FLAGS_tileGridReplayScales.count() > 0) { |
| 2186 outScales->reset(); | 2156 outScales->reset(); |
| 2187 for (int i = 0; i < FLAGS_tileGridReplayScales.count(); i++) { | 2157 for (int i = 0; i < FLAGS_tileGridReplayScales.count(); i++) { |
| 2188 double val = atof(FLAGS_tileGridReplayScales[i]); | 2158 double val = atof(FLAGS_tileGridReplayScales[i]); |
| 2189 if (0 < val) { | 2159 if (0 < val) { |
| 2190 *outScales->append() = SkDoubleToScalar(val); | 2160 *outScales->append() = SkDoubleToScalar(val); |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2261 setSystemPreferences(); | 2231 setSystemPreferences(); |
| 2262 GMMain gmmain; | 2232 GMMain gmmain; |
| 2263 | 2233 |
| 2264 SkTDArray<size_t> configs; | 2234 SkTDArray<size_t> configs; |
| 2265 | 2235 |
| 2266 int moduloRemainder = -1; | 2236 int moduloRemainder = -1; |
| 2267 int moduloDivisor = -1; | 2237 int moduloDivisor = -1; |
| 2268 SkTDArray<const PDFRasterizerData*> pdfRasterizers; | 2238 SkTDArray<const PDFRasterizerData*> pdfRasterizers; |
| 2269 SkTDArray<SkScalar> tileGridReplayScales; | 2239 SkTDArray<SkScalar> tileGridReplayScales; |
| 2270 #if SK_SUPPORT_GPU | 2240 #if SK_SUPPORT_GPU |
| 2271 GrGLStandard gpuAPI = kNone_GrGLStandard; | |
| 2272 GrContextFactory* grFactory = new GrContextFactory; | 2241 GrContextFactory* grFactory = new GrContextFactory; |
| 2273 #else | 2242 #else |
| 2274 GrGLStandard gpuAPI = 0; | |
| 2275 GrContextFactory* grFactory = NULL; | 2243 GrContextFactory* grFactory = NULL; |
| 2276 #endif | 2244 #endif |
| 2277 | 2245 |
| 2278 if (FLAGS_dryRun) { | 2246 if (FLAGS_dryRun) { |
| 2279 SkDebugf( "Doing a dry run; no tests will actually be executed.\n"); | 2247 SkDebugf( "Doing a dry run; no tests will actually be executed.\n"); |
| 2280 } | 2248 } |
| 2281 | 2249 |
| 2282 if (!parse_flags_modulo(&moduloRemainder, &moduloDivisor) || | 2250 if (!parse_flags_modulo(&moduloRemainder, &moduloDivisor) || |
| 2283 !parse_flags_ignore_error_types(&gmmain.fIgnorableErrorTypes) || | 2251 !parse_flags_ignore_error_types(&gmmain.fIgnorableErrorTypes) || |
| 2284 !parse_flags_ignore_tests(gmmain.fIgnorableTestNames) || | 2252 !parse_flags_ignore_tests(gmmain.fIgnorableTestNames) || |
| 2285 #if SK_SUPPORT_GPU | 2253 #if SK_SUPPORT_GPU |
| 2286 !parse_flags_gpu_cache(&gGpuCacheSizeBytes, &gGpuCacheSizeCount) || | 2254 !parse_flags_gpu_cache(&gGpuCacheSizeBytes, &gGpuCacheSizeCount) || |
| 2287 !parse_flags_gl_standard(&gpuAPI) || | |
| 2288 #endif | 2255 #endif |
| 2289 !parse_flags_tile_grid_replay_scales(&tileGridReplayScales) || | 2256 !parse_flags_tile_grid_replay_scales(&tileGridReplayScales) || |
| 2290 !parse_flags_jpeg_quality() || | 2257 !parse_flags_jpeg_quality() || |
| 2291 !parse_flags_configs(&configs, grFactory, gpuAPI) || | 2258 !parse_flags_configs(&configs, grFactory) || |
| 2292 !parse_flags_pdf_rasterizers(configs, &pdfRasterizers) || | 2259 !parse_flags_pdf_rasterizers(configs, &pdfRasterizers) || |
| 2293 !parse_flags_gmmain_paths(&gmmain)) { | 2260 !parse_flags_gmmain_paths(&gmmain)) { |
| 2294 return -1; | 2261 return -1; |
| 2295 } | 2262 } |
| 2296 | 2263 |
| 2297 if (FLAGS_verbose) { | 2264 if (FLAGS_verbose) { |
| 2298 if (FLAGS_writePath.count() == 1) { | 2265 if (FLAGS_writePath.count() == 1) { |
| 2299 SkDebugf("writing to %s\n", FLAGS_writePath[0]); | 2266 SkDebugf("writing to %s\n", FLAGS_writePath[0]); |
| 2300 } | 2267 } |
| 2301 if (NULL != gmmain.fMismatchPath) { | 2268 if (NULL != gmmain.fMismatchPath) { |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2363 | 2330 |
| 2364 if (SkCommandLineFlags::ShouldSkip(FLAGS_match, shortName)) { | 2331 if (SkCommandLineFlags::ShouldSkip(FLAGS_match, shortName)) { |
| 2365 continue; | 2332 continue; |
| 2366 } | 2333 } |
| 2367 | 2334 |
| 2368 gmsRun++; | 2335 gmsRun++; |
| 2369 SkISize size = gm->getISize(); | 2336 SkISize size = gm->getISize(); |
| 2370 SkDebugf("%sdrawing... %s [%d %d]\n", moduloStr.c_str(), shortName, | 2337 SkDebugf("%sdrawing... %s [%d %d]\n", moduloStr.c_str(), shortName, |
| 2371 size.width(), size.height()); | 2338 size.width(), size.height()); |
| 2372 if (!FLAGS_dryRun) | 2339 if (!FLAGS_dryRun) |
| 2373 run_multiple_configs(gmmain, gm, configs, pdfRasterizers, tileGridRe
playScales, | 2340 run_multiple_configs(gmmain, gm, configs, pdfRasterizers, tileGridRe
playScales, grFactory); |
| 2374 grFactory, gpuAPI); | |
| 2375 } | 2341 } |
| 2376 | 2342 |
| 2377 if (FLAGS_dryRun) | 2343 if (FLAGS_dryRun) |
| 2378 return 0; | 2344 return 0; |
| 2379 | 2345 |
| 2380 SkTArray<SkString> modes; | 2346 SkTArray<SkString> modes; |
| 2381 gmmain.GetRenderModesEncountered(modes); | 2347 gmmain.GetRenderModesEncountered(modes); |
| 2382 int modeCount = modes.count(); | 2348 int modeCount = modes.count(); |
| 2383 | 2349 |
| 2384 // Now that we have run all the tests and thus know the full set of renderMo
des that we | 2350 // Now that we have run all the tests and thus know the full set of renderMo
des that we |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2441 stream.write(jsonStdString.c_str(), jsonStdString.length()); | 2407 stream.write(jsonStdString.c_str(), jsonStdString.length()); |
| 2442 } | 2408 } |
| 2443 | 2409 |
| 2444 #if SK_SUPPORT_GPU | 2410 #if SK_SUPPORT_GPU |
| 2445 | 2411 |
| 2446 #if GR_CACHE_STATS | 2412 #if GR_CACHE_STATS |
| 2447 for (int i = 0; i < configs.count(); i++) { | 2413 for (int i = 0; i < configs.count(); i++) { |
| 2448 ConfigData config = gRec[configs[i]]; | 2414 ConfigData config = gRec[configs[i]]; |
| 2449 | 2415 |
| 2450 if (FLAGS_verbose && (kGPU_Backend == config.fBackend)) { | 2416 if (FLAGS_verbose && (kGPU_Backend == config.fBackend)) { |
| 2451 GrContext* gr = grFactory->get(config.fGLContextType, gpuAPI); | 2417 GrContext* gr = grFactory->get(config.fGLContextType); |
| 2452 | 2418 |
| 2453 SkDebugf("config: %s %x\n", config.fName, gr); | 2419 SkDebugf("config: %s %x\n", config.fName, gr); |
| 2454 gr->printCacheStats(); | 2420 gr->printCacheStats(); |
| 2455 } | 2421 } |
| 2456 } | 2422 } |
| 2457 #endif | 2423 #endif |
| 2458 | 2424 |
| 2459 #if GR_DUMP_FONT_CACHE | 2425 #if GR_DUMP_FONT_CACHE |
| 2460 for (int i = 0; i < configs.count(); i++) { | 2426 for (int i = 0; i < configs.count(); i++) { |
| 2461 ConfigData config = gRec[configs[i]]; | 2427 ConfigData config = gRec[configs[i]]; |
| 2462 | 2428 |
| 2463 if (kGPU_Backend == config.fBackend) { | 2429 if (kGPU_Backend == config.fBackend) { |
| 2464 GrContext* gr = grFactory->get(config.fGLContextType, gpuAPI); | 2430 GrContext* gr = grFactory->get(config.fGLContextType); |
| 2465 | 2431 |
| 2466 gr->dumpFontCache(); | 2432 gr->dumpFontCache(); |
| 2467 } | 2433 } |
| 2468 } | 2434 } |
| 2469 #endif | 2435 #endif |
| 2470 | 2436 |
| 2471 delete grFactory; | 2437 delete grFactory; |
| 2472 #endif | 2438 #endif |
| 2473 SkGraphics::Term(); | 2439 SkGraphics::Term(); |
| 2474 | 2440 |
| 2475 return (reportError) ? -1 : 0; | 2441 return (reportError) ? -1 : 0; |
| 2476 } | 2442 } |
| 2477 | 2443 |
| 2478 void GMMain::installFilter(SkCanvas* canvas) { | 2444 void GMMain::installFilter(SkCanvas* canvas) { |
| 2479 if (FLAGS_forceBWtext) { | 2445 if (FLAGS_forceBWtext) { |
| 2480 canvas->setDrawFilter(SkNEW(BWTextDrawFilter))->unref(); | 2446 canvas->setDrawFilter(SkNEW(BWTextDrawFilter))->unref(); |
| 2481 } | 2447 } |
| 2482 } | 2448 } |
| 2483 | 2449 |
| 2484 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) | 2450 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) |
| 2485 int main(int argc, char * const argv[]) { | 2451 int main(int argc, char * const argv[]) { |
| 2486 return tool_main(argc, (char**) argv); | 2452 return tool_main(argc, (char**) argv); |
| 2487 } | 2453 } |
| 2488 #endif | 2454 #endif |
| OLD | NEW |