OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 #include "CrashHandler.h" | 8 #include "CrashHandler.h" |
9 #include "DMJsonWriter.h" | 9 #include "DMJsonWriter.h" |
10 #include "DMSrcSink.h" | 10 #include "DMSrcSink.h" |
(...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
590 ts.tag = tag; | 590 ts.tag = tag; |
591 } | 591 } |
592 | 592 |
593 static bool gpu_supported() { | 593 static bool gpu_supported() { |
594 #if SK_SUPPORT_GPU | 594 #if SK_SUPPORT_GPU |
595 return FLAGS_gpu; | 595 return FLAGS_gpu; |
596 #else | 596 #else |
597 return false; | 597 return false; |
598 #endif | 598 #endif |
599 } | 599 } |
600 | 600 static Sink* create_gpu_sink(const char* tag, GrContextFactory::GLContextType co
ntextType, int samples, bool diText, bool threaded) { |
| 601 #if SK_SUPPORT_GPU |
| 602 GrContextFactory testFactory; |
| 603 const GrGLStandard api = get_gpu_api(); |
| 604 if (testFactory.get(contextType, api)) { |
| 605 return new GPUSink(contextType, api, samples, diText, threaded); |
| 606 } |
| 607 SkDebugf("WARNING: can not create GPU context for config '%s'. GM tests will
be skipped.\n", tag); |
| 608 #endif |
| 609 return nullptr; |
| 610 } |
601 static Sink* create_sink(const char* tag) { | 611 static Sink* create_sink(const char* tag) { |
602 #define SINK(t, sink, ...) if (0 == strcmp(t, tag)) { return new sink(__VA_ARGS_
_); } | 612 #define GPU_SINK(t, ...) if (0 == strcmp(t, tag)) { return create_gpu_sink(tag,
__VA_ARGS__); } |
603 if (gpu_supported()) { | 613 if (gpu_supported()) { |
604 typedef GrContextFactory Gr; | 614 typedef GrContextFactory Gr; |
605 const GrGLStandard api = get_gpu_api(); | 615 GPU_SINK("gpunull", Gr::kNull_GLContextType, 0, false, F
LAGS_gpu_threading); |
606 SINK("gpunull", GPUSink, Gr::kNull_GLContextType, api, 0
, false, FLAGS_gpu_threading); | 616 GPU_SINK("gpudebug", Gr::kDebug_GLContextType, 0, false, F
LAGS_gpu_threading); |
607 SINK("gpudebug", GPUSink, Gr::kDebug_GLContextType, api, 0
, false, FLAGS_gpu_threading); | 617 GPU_SINK("gpu", Gr::kNative_GLContextType, 0, false, F
LAGS_gpu_threading); |
608 SINK("gpu", GPUSink, Gr::kNative_GLContextType, api, 0
, false, FLAGS_gpu_threading); | 618 GPU_SINK("gpudft", Gr::kNative_GLContextType, 0, true, F
LAGS_gpu_threading); |
609 SINK("gpudft", GPUSink, Gr::kNative_GLContextType, api, 0
, true, FLAGS_gpu_threading); | 619 GPU_SINK("msaa4", Gr::kNative_GLContextType, 4, false, F
LAGS_gpu_threading); |
610 SINK("msaa4", GPUSink, Gr::kNative_GLContextType, api, 4
, false, FLAGS_gpu_threading); | 620 GPU_SINK("msaa16", Gr::kNative_GLContextType, 16, false, F
LAGS_gpu_threading); |
611 SINK("msaa16", GPUSink, Gr::kNative_GLContextType, api, 16
, false, FLAGS_gpu_threading); | 621 GPU_SINK("nvprmsaa4", Gr::kNVPR_GLContextType, 4, true, F
LAGS_gpu_threading); |
612 SINK("nvprmsaa4", GPUSink, Gr::kNVPR_GLContextType, api, 4
, true, FLAGS_gpu_threading); | 622 GPU_SINK("nvprmsaa16", Gr::kNVPR_GLContextType, 16, true, F
LAGS_gpu_threading); |
613 SINK("nvprmsaa16", GPUSink, Gr::kNVPR_GLContextType, api, 16
, true, FLAGS_gpu_threading); | 623 #if SK_ANGLE |
614 #if SK_ANGLE | 624 GPU_SINK("angle", Gr::kANGLE_GLContextType, 0, false, F
LAGS_gpu_threading); |
615 SINK("angle", GPUSink, Gr::kANGLE_GLContextType, api, 0
, false, FLAGS_gpu_threading); | 625 GPU_SINK("angle-gl", Gr::kANGLE_GL_GLContextType, 0, false, F
LAGS_gpu_threading); |
616 SINK("angle-gl", GPUSink, Gr::kANGLE_GL_GLContextType, api, 0
, false, FLAGS_gpu_threading); | 626 #endif |
617 #endif | 627 #if SK_COMMAND_BUFFER |
618 #if SK_COMMAND_BUFFER | 628 GPU_SINK("commandbuffer", Gr::kCommandBuffer_GLContextType, 0, false, F
LAGS_gpu_threading); |
619 SINK("commandbuffer", GPUSink, Gr::kCommandBuffer_GLContextType, api, 0
, false, FLAGS_gpu_threading); | 629 #endif |
620 #endif | 630 #if SK_MESA |
621 #if SK_MESA | 631 GPU_SINK("mesa", Gr::kMESA_GLContextType, 0, false, F
LAGS_gpu_threading); |
622 SINK("mesa", GPUSink, Gr::kMESA_GLContextType, api, 0
, false, FLAGS_gpu_threading); | 632 #endif |
623 #endif | |
624 } | 633 } |
| 634 #undef GPU_SINK |
625 | 635 |
| 636 #define SINK(t, sink, ...) if (0 == strcmp(t, tag)) { return new sink(__VA_ARGS_
_); } |
626 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK | 637 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK |
627 SINK("hwui", HWUISink); | 638 SINK("hwui", HWUISink); |
628 #endif | 639 #endif |
629 | 640 |
630 if (FLAGS_cpu) { | 641 if (FLAGS_cpu) { |
631 SINK("565", RasterSink, kRGB_565_SkColorType); | 642 SINK("565", RasterSink, kRGB_565_SkColorType); |
632 SINK("8888", RasterSink, kN32_SkColorType); | 643 SINK("8888", RasterSink, kN32_SkColorType); |
633 SINK("pdf", PDFSink, "Pdfium"); | 644 SINK("pdf", PDFSink, "Pdfium"); |
634 SINK("pdf_poppler", PDFSink, "Poppler"); | 645 SINK("pdf_poppler", PDFSink, "Poppler"); |
635 SINK("skp", SKPSink); | 646 SINK("skp", SKPSink); |
(...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1204 Reporter* reporter, | 1215 Reporter* reporter, |
1205 GrContextFactory* fac
tory); | 1216 GrContextFactory* fac
tory); |
1206 } // namespace skiatest | 1217 } // namespace skiatest |
1207 | 1218 |
1208 #if !defined(SK_BUILD_FOR_IOS) | 1219 #if !defined(SK_BUILD_FOR_IOS) |
1209 int main(int argc, char** argv) { | 1220 int main(int argc, char** argv) { |
1210 SkCommandLineFlags::Parse(argc, argv); | 1221 SkCommandLineFlags::Parse(argc, argv); |
1211 return dm_main(); | 1222 return dm_main(); |
1212 } | 1223 } |
1213 #endif | 1224 #endif |
OLD | NEW |