Index: dm/DM.cpp |
diff --git a/dm/DM.cpp b/dm/DM.cpp |
index 1b7c1d84724c5a724e3180256761bc0e2329b08c..d8dc6f5100383f053412d51676cb776da03706ca 100644 |
--- a/dm/DM.cpp |
+++ b/dm/DM.cpp |
@@ -36,8 +36,15 @@ using skiagm::GMRegistry; |
using skiatest::Test; |
using skiatest::TestRegistry; |
+static const char kGpuApiNameGL[] = "gl"; |
+static const char kGpuApiNameGLES[] = "gles"; |
+ |
DEFINE_int32(threads, -1, "Threads for CPU work. Default NUM_CPUS."); |
DEFINE_int32(gpuThreads, 1, "Threads for GPU work."); |
+DEFINE_string(forceGpuApi, "", "Force use of specific gpu API. Using \"gl\" " |
mtklein
2014/06/09 14:10:46
Personally I'd go with just gpuAPI?
Is there any
bsalomon
2014/06/09 14:15:11
It definitely *could* be implemented that way. One
mtklein
2014/06/09 14:20:21
Yeah, this is fine, we can cross them here inside
bsalomon
2014/06/09 14:29:52
If we move towards supporting arbitrary members of
Kimmo Kinnunen
2014/06/16 12:36:40
Done.
|
+ "forces OpenGL API. Using \"gles\" forces OpenGL ES API. " |
+ "Defaults to empty string, which selects the API native to the " |
+ "system."); |
#ifdef SK_BUILD_JSON_WRITER |
DEFINE_string2(expectations, r, "", |
"If a directory, compare generated images against images under this path. " |
@@ -100,6 +107,7 @@ native; |
static void kick_off_gms(const SkTDArray<GMRegistry::Factory>& gms, |
const SkTArray<SkString>& configs, |
+ GrGLStandard forcedGpuApi, |
const DM::Expectations& expectations, |
DM::Reporter* reporter, |
DM::TaskRunner* tasks) { |
@@ -112,15 +120,15 @@ static void kick_off_gms(const SkTDArray<GMRegistry::Factory>& gms, |
for (int j = 0; j < configs.count(); j++) { |
START("565", CpuGMTask, kRGB_565_SkColorType); |
START("8888", CpuGMTask, kN32_SkColorType); |
- START("gpu", GpuGMTask, native, 0); |
- START("msaa4", GpuGMTask, native, 4); |
- START("msaa16", GpuGMTask, native, 16); |
- START("nvprmsaa4", GpuGMTask, nvpr, 4); |
- START("nvprmsaa16", GpuGMTask, nvpr, 16); |
- START("gpunull", GpuGMTask, null, 0); |
- START("gpudebug", GpuGMTask, debug, 0); |
- START("angle", GpuGMTask, angle, 0); |
- START("mesa", GpuGMTask, mesa, 0); |
+ START("gpu", GpuGMTask, native, forcedGpuApi, 0); |
+ START("msaa4", GpuGMTask, native, forcedGpuApi, 4); |
+ START("msaa16", GpuGMTask, native, forcedGpuApi, 16); |
+ START("nvprmsaa4", GpuGMTask, nvpr, forcedGpuApi, 4); |
+ START("nvprmsaa16", GpuGMTask, nvpr, forcedGpuApi, 16); |
+ START("gpunull", GpuGMTask, null, forcedGpuApi, 0); |
+ START("gpudebug", GpuGMTask, debug, forcedGpuApi, 0); |
+ START("angle", GpuGMTask, angle, forcedGpuApi, 0); |
+ START("mesa", GpuGMTask, mesa, forcedGpuApi, 0); |
START("pdf", PDFTask, RASTERIZE_PDF_PROC); |
} |
} |
@@ -129,6 +137,7 @@ static void kick_off_gms(const SkTDArray<GMRegistry::Factory>& gms, |
static void kick_off_benches(const SkTDArray<BenchRegistry::Factory>& benches, |
const SkTArray<SkString>& configs, |
+ GrGLStandard forcedGpuApi, |
DM::Reporter* reporter, |
DM::TaskRunner* tasks) { |
#define START(name, type, ...) \ |
@@ -140,15 +149,15 @@ static void kick_off_benches(const SkTDArray<BenchRegistry::Factory>& benches, |
START("nonrendering", NonRenderingBenchTask); |
START("565", CpuBenchTask, kRGB_565_SkColorType); |
START("8888", CpuBenchTask, kN32_SkColorType); |
- START("gpu", GpuBenchTask, native, 0); |
- START("msaa4", GpuBenchTask, native, 4); |
- START("msaa16", GpuBenchTask, native, 16); |
- START("nvprmsaa4", GpuBenchTask, nvpr, 4); |
- START("nvprmsaa16", GpuBenchTask, nvpr, 16); |
- START("gpunull", GpuBenchTask, null, 0); |
- START("gpudebug", GpuBenchTask, debug, 0); |
- START("angle", GpuBenchTask, angle, 0); |
- START("mesa", GpuBenchTask, mesa, 0); |
+ START("gpu", GpuBenchTask, native, forcedGpuApi, 0); |
+ START("msaa4", GpuBenchTask, native, forcedGpuApi, 4); |
+ START("msaa16", GpuBenchTask, native, forcedGpuApi, 16); |
+ START("nvprmsaa4", GpuBenchTask, nvpr, forcedGpuApi, 4); |
+ START("nvprmsaa16", GpuBenchTask, nvpr, forcedGpuApi, 16); |
+ START("gpunull", GpuBenchTask, null, forcedGpuApi, 0); |
+ START("gpudebug", GpuBenchTask, debug, forcedGpuApi, 0); |
+ START("angle", GpuBenchTask, angle, forcedGpuApi, 0); |
+ START("mesa", GpuBenchTask, mesa, forcedGpuApi, 0); |
} |
} |
#undef START |
@@ -208,6 +217,19 @@ static void report_failures(const SkTArray<SkString>& failures) { |
SkDebugf("%d failures.\n", failures.count()); |
} |
+static void get_forced_gpu_api_if_matches(GrGLStandard* forcedGpuApi) { |
mtklein
2014/06/09 14:10:45
Simplify?
static GrGLStandard get_gl_standard() {
Kimmo Kinnunen
2014/06/16 12:36:39
Done.
|
+ if (1 == FLAGS_forceGpuApi.count()) { |
+ if (strcmp(FLAGS_forceGpuApi[0], kGpuApiNameGL) == 0) { |
+ *forcedGpuApi = kGL_GrGLStandard; |
+ return; |
+ } else if (strcmp(FLAGS_forceGpuApi[0], kGpuApiNameGLES) == 0) { |
+ *forcedGpuApi = kGLES_GrGLStandard; |
+ return; |
+ } |
+ } |
+ *forcedGpuApi = kNone_GrGLStandard; |
mtklein
2014/06/09 14:10:45
What happens if I run DM in None mode? Does that
Kimmo Kinnunen
2014/06/16 12:36:39
Yeah. None picks up the default for the platform.
|
+} |
+ |
template <typename T, typename Registry> |
static void append_matching_factories(Registry* head, SkTDArray<typename Registry::Factory>* out) { |
for (const Registry* reg = head; reg != NULL; reg = reg->next()) { |
@@ -238,6 +260,9 @@ int tool_main(int argc, char** argv) { |
SkStrSplit(FLAGS_config[i], ", ", &configs); |
} |
+ GrGLStandard forcedGpuApi = kNone_GrGLStandard; |
+ get_forced_gpu_api_if_matches(&forcedGpuApi); |
+ |
SkTDArray<GMRegistry::Factory> gms; |
SkAutoTDelete<DM::Expectations> expectations(SkNEW(DM::NoExpectations)); |
if (FLAGS_gms) { |
@@ -269,8 +294,8 @@ int tool_main(int argc, char** argv) { |
gms.count(), benches.count(), configs.count(), tests.count()); |
DM::Reporter reporter; |
DM::TaskRunner tasks(FLAGS_threads, FLAGS_gpuThreads); |
- kick_off_gms(gms, configs, *expectations, &reporter, &tasks); |
- kick_off_benches(benches, configs, &reporter, &tasks); |
+ kick_off_gms(gms, configs, forcedGpuApi, *expectations, &reporter, &tasks); |
mtklein
2014/06/09 14:10:45
e.g. could we logically just loop over GPU APIs he
Kimmo Kinnunen
2014/06/16 12:36:39
IIUC from the discussion above, this was not neede
bsalomon
2014/06/16 14:25:10
+1 for leaving any running of multiple APIs in a s
|
+ kick_off_benches(benches, configs, forcedGpuApi, &reporter, &tasks); |
kick_off_tests(tests, &reporter, &tasks); |
kick_off_skps(&reporter, &tasks); |
tasks.wait(); |