Expose '--notexturecache' command line argument to gm.
authortwiz@google.com <twiz@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Tue, 31 Jan 2012 18:35:30 +0000 (18:35 +0000)
committertwiz@google.com <twiz@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Tue, 31 Jan 2012 18:35:30 +0000 (18:35 +0000)
Pass '--notexturecache' to gm to resize the Ganesh texture cache to 0.  This stresses Ganesh's behaviour after a cache purge operation.
Review URL: https://codereview.appspot.com/5569079

git-svn-id: http://skia.googlecode.com/svn/trunk@3123 2bbb7eff-a529-9590-31e7-b0007b416f81

gm/gmmain.cpp

index 7be822a..455f7fe 100644 (file)
@@ -590,7 +590,7 @@ static void usage(const char * argv0) {
     SkDebugf(
         "%s [-w writePath] [-r readPath] [-d diffPath] [--noreplay]\n"
         "    [--serialize] [--forceBWtext] [--nopdf] [--nodeferred]\n"
-        "    [--match substring]"
+        "    [--match substring] [--notexturecache]"
 #if SK_MESA
         " [--mesagl]"
 #endif
@@ -610,6 +610,7 @@ static void usage(const char * argv0) {
 #if SK_MESA
     SkDebugf("    --mesagl will run using the osmesa sw gl rasterizer.\n");
 #endif
+    SkDebugf("    --notexturecache: disable the gpu texture cache.\n");
 }
 
 static const ConfigData gRec[] = {
@@ -658,13 +659,14 @@ int main(int argc, char * const argv[]) {
     const char* diffPath = NULL;    // if non-null, where we write our diffs (from compare)
 
     SkTDArray<const char*> fMatches;
-    
+
     bool doPDF = true;
     bool doReplay = true;
     bool doSerialize = false;
     bool useMesa = false;
     bool doDeferred = true;
-    
+    bool disableTextureCache = false;
+
     const char* const commandName = argv[0];
     char* const* stop = argv + argc;
     for (++argv; argv < stop; ++argv) {
@@ -703,6 +705,8 @@ int main(int argc, char * const argv[]) {
         } else if (strcmp(*argv, "--mesagl") == 0) {
             useMesa = true;
 #endif
+        } else if (strcmp(*argv, "--notexturecache") == 0) {
+          disableTextureCache = true;
         } else {
           usage(commandName);
           return -1;
@@ -759,6 +763,10 @@ int main(int argc, char * const argv[]) {
     int testsFailed = 0;
     int testsMissingReferenceImages = 0;
 
+    if (disableTextureCache) {
+        skiagm::GetGr()->setTextureCacheLimits(0, 0);
+    }
+
     iter.reset();
     while ((gm = iter.next()) != NULL) {
         const char* shortName = gm->shortName();
@@ -788,7 +796,7 @@ int main(int argc, char * const argv[]) {
         for (size_t i = 0; i < SK_ARRAY_COUNT(gRec); i++) {
             // Skip any tests that we don't even need to try.
             uint32_t gmFlags = gm->getFlags();
-            if ((kPDF_Backend == gRec[i].fBackend) && 
+            if ((kPDF_Backend == gRec[i].fBackend) &&
                 (!doPDF || (gmFlags & GM::kSkipPDF_Flag)))
             {
                 continue;
@@ -813,7 +821,7 @@ int main(int argc, char * const argv[]) {
             }
 
             if (doDeferred && !testErrors &&
-                (kGPU_Backend == gRec[i].fBackend || 
+                (kGPU_Backend == gRec[i].fBackend ||
                 kRaster_Backend == gRec[i].fBackend)) {
                 testErrors |= test_deferred_drawing(gm, gRec[i],
                                     forwardRenderedBitmap,