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

Side by Side Diff: gm/gmmain.cpp

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

Powered by Google App Engine
This is Rietveld 408576698