Support mesa config in render_pictures.
authorrmistry@google.com <rmistry@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Mon, 6 Jan 2014 18:37:24 +0000 (18:37 +0000)
committerrmistry@google.com <rmistry@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Mon, 6 Jan 2014 18:37:24 +0000 (18:37 +0000)
R=epoger@google.com, robertphillips@google.com

Review URL: https://codereview.chromium.org/125083004

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

tools/PictureRenderer.cpp
tools/PictureRenderer.h
tools/PictureRenderingFlags.cpp

index de7e641..b61288a 100644 (file)
@@ -146,6 +146,10 @@ SkCanvas* PictureRenderer::setupCanvas(int width, int height) {
         case kAngle_DeviceType:
             // fall through
 #endif
+#if SK_MESA
+        case kMesa_DeviceType:
+            // fall through
+#endif
         case kGPU_DeviceType: {
             SkAutoTUnref<GrSurface> target;
             if (fGrContext) {
index e524aa1..c4b97f2 100644 (file)
@@ -69,6 +69,9 @@ public:
 #if SK_ANGLE
         kAngle_DeviceType,
 #endif
+#if SK_MESA
+        kMesa_DeviceType,
+#endif
         kBitmap_DeviceType,
 #if SK_SUPPORT_GPU
         kGPU_DeviceType,
@@ -177,6 +180,11 @@ public:
                 glContextType = GrContextFactory::kANGLE_GLContextType;
                 break;
 #endif
+#if SK_MESA
+            case kMesa_DeviceType:
+                glContextType = GrContextFactory::kMESA_GLContextType;
+                break;
+#endif
 #endif
             default:
                 // Invalid device type.
@@ -256,6 +264,11 @@ public:
                 config.append("_angle");
                 break;
 #endif
+#if SK_MESA
+            case kMesa_DeviceType:
+                config.append("_mesa");
+                break;
+#endif
             default:
                 // Assume that no extra info means bitmap.
                 break;
@@ -272,6 +285,10 @@ public:
                 // fall through
 #if SK_ANGLE
             case kAngle_DeviceType:
+                // fall through
+#endif
+#if SK_MESA
+            case kMesa_DeviceType:
 #endif
                 return true;
             default:
@@ -291,6 +308,11 @@ public:
                 glContextType = GrContextFactory::kANGLE_GLContextType;
                 break;
 #endif
+#if SK_MESA
+            case kMesa_DeviceType:
+                glContextType = GrContextFactory::kMESA_GLContextType;
+                break;
+#endif
             default:
                 return NULL;
         }
index 2aae77f..e1cc72f 100644 (file)
@@ -25,14 +25,18 @@ DEFINE_string(bbh, "none", "bbhType [width height]: Set the bounding box hierarc
               "playbackCreation.");
 // Although this config does not support all the same options as gm, the names should be kept
 // consistent.
+DEFINE_string(config, "8888", "["
+              "8888"
+#if SK_SUPPORT_GPU
+              "|gpu|msaa4|msaa16"
+#endif
 #if SK_ANGLE
-// ANGLE assumes GPU
-DEFINE_string(config, "8888", "[8888|gpu|msaa4|msaa16|angle]: Use the corresponding config.");
-#elif SK_SUPPORT_GPU
-DEFINE_string(config, "8888", "[8888|gpu|msaa4|msaa16]: Use the corresponding config.");
-#else
-DEFINE_string(config, "8888", "[8888]: Use the corresponding config.");
+              "|angle"
 #endif
+#if SK_MESA
+              "|mesa"
+#endif
+              "]: Use the corresponding config.");
 
 DEFINE_bool(deferImageDecoding, false, "Defer decoding until drawing images. "
             "Has no effect if the provided skp does not have its images encoded.");
@@ -285,6 +289,15 @@ sk_tools::PictureRenderer* parseRenderer(SkString& error, PictureTool tool) {
             }
         }
 #endif
+#if SK_MESA
+        else if (0 == strcmp(FLAGS_config[0], "mesa")) {
+            deviceType = sk_tools::PictureRenderer::kMesa_DeviceType;
+            if (FLAGS_multi > 1) {
+                error.printf("Mesa not compatible with multithreaded tiling.\n");
+                return NULL;
+            }
+        }
+#endif
 #endif
         else {
             error.printf("%s is not a valid mode for --config\n", FLAGS_config[0]);