OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 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 "Viewer.h" | 8 #include "Viewer.h" |
9 | 9 |
10 #include "GMSlide.h" | 10 #include "GMSlide.h" |
(...skipping 40 matching lines...) Loading... |
51 DEFINE_string(key, "", "Space-separated key/value pairs to add to JSON identifyi
ng this builder."); | 51 DEFINE_string(key, "", "Space-separated key/value pairs to add to JSON identifyi
ng this builder."); |
52 DEFINE_string2(match, m, nullptr, | 52 DEFINE_string2(match, m, nullptr, |
53 "[~][^]substring[$] [...] of bench name to run.\n" | 53 "[~][^]substring[$] [...] of bench name to run.\n" |
54 "Multiple matches may be separated by spaces.\n" | 54 "Multiple matches may be separated by spaces.\n" |
55 "~ causes a matching bench to always be skipped\n" | 55 "~ causes a matching bench to always be skipped\n" |
56 "^ requires the start of the bench to match\n" | 56 "^ requires the start of the bench to match\n" |
57 "$ requires the end of the bench to match\n" | 57 "$ requires the end of the bench to match\n" |
58 "^ and $ requires an exact match\n" | 58 "^ and $ requires an exact match\n" |
59 "If a bench does not match any list entry,\n" | 59 "If a bench does not match any list entry,\n" |
60 "it is skipped unless some list entry starts with ~"); | 60 "it is skipped unless some list entry starts with ~"); |
| 61 |
| 62 #ifdef SK_VULKAN |
| 63 # define BACKENDS_STR "\"sw\", \"gl\", and \"vulkan\"" |
| 64 #else |
| 65 # define BACKENDS_STR "\"sw\" and \"gl\"" |
| 66 #endif |
| 67 |
61 #ifdef SK_BUILD_FOR_ANDROID | 68 #ifdef SK_BUILD_FOR_ANDROID |
62 DEFINE_string(skps, "/data/local/tmp/skia", "Directory to read skps from."); | 69 DEFINE_string(skps, "/data/local/tmp/skia", "Directory to read skps from."); |
63 DEFINE_string(jpgs, "/data/local/tmp/skia", "Directory to read jpgs from."); | 70 DEFINE_string(jpgs, "/data/local/tmp/skia", "Directory to read jpgs from."); |
64 DEFINE_bool(vulkan, false, "Run with Vulkan."); | |
65 #else | 71 #else |
66 DEFINE_string(skps, "skps", "Directory to read skps from."); | 72 DEFINE_string(skps, "skps", "Directory to read skps from."); |
67 DEFINE_string(jpgs, "jpgs", "Directory to read jpgs from."); | 73 DEFINE_string(jpgs, "jpgs", "Directory to read jpgs from."); |
68 DEFINE_bool(vulkan, true, "Run with Vulkan."); | |
69 #endif | 74 #endif |
70 | 75 |
| 76 DEFINE_string2(backend, b, "sw", "Backend to use. Allowed values are " BACKENDS_
STR "."); |
| 77 |
71 const char *kBackendTypeStrings[sk_app::Window::kBackendTypeCount] = { | 78 const char *kBackendTypeStrings[sk_app::Window::kBackendTypeCount] = { |
72 " [OpenGL]", | 79 " [OpenGL]", |
73 #ifdef SK_VULKAN | 80 #ifdef SK_VULKAN |
74 " [Vulkan]", | 81 " [Vulkan]", |
75 #endif | 82 #endif |
76 " [Raster]" | 83 " [Raster]" |
77 }; | 84 }; |
78 | 85 |
| 86 static sk_app::Window::BackendType get_backend_type(const char* str) { |
| 87 #ifdef SK_VULKAN |
| 88 if (0 == strcmp(str, "vk")) { |
| 89 return sk_app::Window::kVulkan_BackendType; |
| 90 } else |
| 91 #endif |
| 92 if (0 == strcmp(str, "gl")) { |
| 93 return sk_app::Window::kNativeGL_BackendType; |
| 94 } else if (0 == strcmp(str, "sw")) { |
| 95 return sk_app::Window::kRaster_BackendType; |
| 96 } else { |
| 97 SkDebugf("Unknown backend type, %s, defaulting to sw.", str); |
| 98 return sk_app::Window::kRaster_BackendType; |
| 99 } |
| 100 } |
| 101 |
79 const char* kName = "name"; | 102 const char* kName = "name"; |
80 const char* kValue = "value"; | 103 const char* kValue = "value"; |
81 const char* kOptions = "options"; | 104 const char* kOptions = "options"; |
82 const char* kSlideStateName = "Slide"; | 105 const char* kSlideStateName = "Slide"; |
83 const char* kBackendStateName = "Backend"; | 106 const char* kBackendStateName = "Backend"; |
84 const char* kSoftkeyStateName = "Softkey"; | 107 const char* kSoftkeyStateName = "Softkey"; |
85 const char* kSoftkeyHint = "Please select a softkey"; | 108 const char* kSoftkeyHint = "Please select a softkey"; |
86 const char* kFpsStateName = "FPS"; | 109 const char* kFpsStateName = "FPS"; |
87 const char* kSplitScreenStateName = "Split screen"; | 110 const char* kSplitScreenStateName = "Split screen"; |
88 const char* kON = "ON"; | 111 const char* kON = "ON"; |
(...skipping 14 matching lines...) Loading... |
103 memset(fMeasurements, 0, sizeof(fMeasurements)); | 126 memset(fMeasurements, 0, sizeof(fMeasurements)); |
104 | 127 |
105 SkDebugf("Command line arguments: "); | 128 SkDebugf("Command line arguments: "); |
106 for (int i = 1; i < argc; ++i) { | 129 for (int i = 1; i < argc; ++i) { |
107 SkDebugf("%s ", argv[i]); | 130 SkDebugf("%s ", argv[i]); |
108 } | 131 } |
109 SkDebugf("\n"); | 132 SkDebugf("\n"); |
110 | 133 |
111 SkCommandLineFlags::Parse(argc, argv); | 134 SkCommandLineFlags::Parse(argc, argv); |
112 | 135 |
113 #ifdef SK_VULKAN | 136 fBackendType = get_backend_type(FLAGS_backend[0]); |
114 fBackendType = FLAGS_vulkan ? sk_app::Window::kVulkan_BackendType | |
115 : sk_app::Window::kNativeGL_BackendType; | |
116 #endif | |
117 fWindow = Window::CreateNativeWindow(platformData); | 137 fWindow = Window::CreateNativeWindow(platformData); |
118 fWindow->attach(fBackendType, DisplayParams()); | 138 fWindow->attach(fBackendType, DisplayParams()); |
119 | 139 |
120 // register callbacks | 140 // register callbacks |
121 fCommands.attach(fWindow); | 141 fCommands.attach(fWindow); |
122 fWindow->registerPaintFunc(on_paint_handler, this); | 142 fWindow->registerPaintFunc(on_paint_handler, this); |
123 fWindow->registerTouchFunc(on_touch_handler, this); | 143 fWindow->registerTouchFunc(on_touch_handler, this); |
124 fWindow->registerUIStateChangedFunc(on_ui_state_changed_handler, this); | 144 fWindow->registerUIStateChangedFunc(on_ui_state_changed_handler, this); |
125 | 145 |
126 // add key-bindings | 146 // add key-bindings |
(...skipping 481 matching lines...) Loading... |
608 updateUIState(); | 628 updateUIState(); |
609 } | 629 } |
610 } else if (stateName.equals(kRefreshStateName)) { | 630 } else if (stateName.equals(kRefreshStateName)) { |
611 // This state is actually NOT in the UI state. | 631 // This state is actually NOT in the UI state. |
612 // We use this to allow Android to quickly set bool fRefresh. | 632 // We use this to allow Android to quickly set bool fRefresh. |
613 fRefresh = stateValue.equals(kON); | 633 fRefresh = stateValue.equals(kON); |
614 } else { | 634 } else { |
615 SkDebugf("Unknown stateName: %s", stateName.c_str()); | 635 SkDebugf("Unknown stateName: %s", stateName.c_str()); |
616 } | 636 } |
617 } | 637 } |
OLD | NEW |