Index: gm/gmmain.cpp |
=================================================================== |
--- gm/gmmain.cpp (revision 8044) |
+++ gm/gmmain.cpp (working copy) |
@@ -1033,6 +1033,10 @@ |
" unable to read a reference image for any tests (default behavior)\n" |
" [--exclude-config]: disable this config (may be used multiple times)\n" |
" [--forceBWtext]: disable text anti-aliasing\n" |
+#if SK_SUPPORT_GPU |
robertphillips
2013/03/08 19:51:51
0 for both will disable the cache?
bsalomon
2013/03/08 20:01:05
Done.
|
+" [--gpucachesize <size> <count>]: limits gpu cache to size bytes or count objects\n" |
+" -1 for either value means use the default\n" |
+#endif |
" [--help|-h]: show this help message\n" |
" [--hierarchy|--nohierarchy]: whether to use multilevel directory structure\n" |
" when reading/writing files; default is no\n" |
@@ -1049,7 +1053,6 @@ |
" [--resourcePath|-i <path>]: directory that stores image resources\n" |
" [--nortree]: Do not exercise the R-Tree variant of SkPicture\n" |
" [--noserialize]: do not exercise SkPicture serialization & deserialization\n" |
-" [--notexturecache]: disable the gpu texture cache\n" |
" [--tiledPipe]: Exercise tiled SkGPipe replay\n" |
" [--notileGrid]: Do not exercise the tile grid variant of SkPicture\n" |
" [--tileGridReplayScales <scales>]: Comma separated list of floating-point scale\n" |
@@ -1166,9 +1169,7 @@ |
bool doRTree = true; |
bool doTileGrid = true; |
bool doVerbose = false; |
-#if SK_SUPPORT_GPU |
- bool disableTextureCache = false; |
-#endif |
+ |
SkTDArray<size_t> configs; |
SkTDArray<size_t> excludeConfigs; |
SkTDArray<SkScalar> tileGridReplayScales; |
@@ -1178,6 +1179,13 @@ |
int moduloRemainder = -1; |
int moduloDivisor = -1; |
+#if SK_SUPPORT_GPU |
+ struct { |
+ size_t fBytes; |
+ int fCount; |
+ } gpuCacheSize = { -1, -1 }; // -1s mean use the default |
+#endif |
+ |
const char* const commandName = argv[0]; |
char* const* stop = argv + argc; |
for (++argv; argv < stop; ++argv) { |
@@ -1253,6 +1261,13 @@ |
notifyMissingReadReference = true; |
} else if (strcmp(*argv, "--forceBWtext") == 0) { |
gForceBWtext = true; |
+#if SK_SUPPORT_GPU |
+ } else if (strcmp(*argv, "--gpucachesize") == 0) { |
+ if (stop - argv > 2) { |
+ gpuCacheSize.fBytes = atoi(*++argv); |
+ gpuCacheSize.fCount = atoi(*++argv); |
+ } |
robertphillips
2013/03/08 19:51:51
else {
SkDebugf("missing arg for --gpucachesiz
bsalomon
2013/03/08 20:00:12
Done.
|
+#endif |
} else if (strcmp(*argv, "--help") == 0 || strcmp(*argv, "-h") == 0) { |
usage(commandName); |
return -1; |
@@ -1304,10 +1319,6 @@ |
doSerialize = true; |
} else if (strcmp(*argv, "--noserialize") == 0) { |
doSerialize = false; |
- } else if (strcmp(*argv, "--notexturecache") == 0) { |
-#if SK_SUPPORT_GPU |
- disableTextureCache = true; |
-#endif |
} else if (strcmp(*argv, "--tiledPipe") == 0) { |
doTiledPipe = true; |
} else if (!strcmp(*argv, "--verbose") || !strcmp(*argv, "-v")) { |
@@ -1408,9 +1419,6 @@ |
#if SK_SUPPORT_GPU |
GrContextFactory* grFactory = new GrContextFactory; |
- if (disableTextureCache) { |
- skiagm::GetGr()->setTextureCacheLimits(0, 0); |
- } |
#endif |
int gmIndex = -1; |
@@ -1506,6 +1514,16 @@ |
renderTarget = rt.get(); |
grSuccess = NULL != renderTarget; |
} |
robertphillips
2013/03/08 19:51:51
// Set the passed in texture cache limits?
bsalomon
2013/03/08 20:00:12
Done.
|
+ size_t bytes; |
+ int count; |
+ gr->getTextureCacheLimits(&count, &bytes); |
+ if (-1 != gpuCacheSize.fBytes) { |
+ bytes = gpuCacheSize.fBytes; |
+ } |
+ if (-1 != gpuCacheSize.fCount) { |
+ count = gpuCacheSize.fCount; |
+ } |
+ gr->setTextureCacheLimits(count, bytes); |
} |
if (!grSuccess) { |
renderErrors |= kNoGpuContext_ErrorBitmask; |