aboutsummaryrefslogtreecommitdiffhomepage
path: root/dm/DM.cpp
diff options
context:
space:
mode:
authorGravatar csmartdalton <csmartdalton@google.com>2017-02-22 12:00:42 -0700
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-02-22 20:29:56 +0000
commit008b9d80ab9adbf2656eceaf54d11cd15e4dda05 (patch)
tree06d4863dc3f65dcdb6704ec65f31800e544ea181 /dm/DM.cpp
parent19eec39c90a357ff3476d65f2c672096f55518e3 (diff)
Add the ability to enable/disable GPU path renderers
Adds a bitfield to GrContextOptions that masks out path renderers. Adds commandline flags support to set this bitfield in tools apps. Removes GrGLInterfaceRemoveNVPR since we can now accomplish the same thing in the context options. BUG=skia: Change-Id: Icf2a4df36374b3ba2f69ebf0db56e8aedd6cf65f Reviewed-on: https://skia-review.googlesource.com/8786 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Chris Dalton <csmartdalton@google.com>
Diffstat (limited to 'dm/DM.cpp')
-rw-r--r--dm/DM.cpp28
1 files changed, 19 insertions, 9 deletions
diff --git a/dm/DM.cpp b/dm/DM.cpp
index c25076ff06..5e3185bb30 100644
--- a/dm/DM.cpp
+++ b/dm/DM.cpp
@@ -16,6 +16,7 @@
#include "SkColorSpace.h"
#include "SkCommonFlags.h"
#include "SkCommonFlagsConfig.h"
+#include "SkCommonFlagsPathRenderer.h"
#include "SkData.h"
#include "SkFontMgr.h"
#include "SkGraphics.h"
@@ -77,6 +78,10 @@ DEFINE_int32(shard, 0, "Which shard do I run?");
DEFINE_string(mskps, "", "Directory to read mskps from, or a single mskp file.");
+#if SK_SUPPORT_GPU
+DEFINE_pathrenderer_flag;
+#endif
+
using namespace DM;
using sk_gpu_test::GrContextFactory;
using sk_gpu_test::GLTestContext;
@@ -838,13 +843,13 @@ static bool gpu_supported() {
#endif
}
-static Sink* create_sink(const SkCommandLineConfig* config) {
+static Sink* create_sink(const GrContextOptions& grCtxOptions, const SkCommandLineConfig* config) {
#if SK_SUPPORT_GPU
if (gpu_supported()) {
if (const SkCommandLineConfigGpu* gpuConfig = config->asConfigGpu()) {
GrContextFactory::ContextType contextType = gpuConfig->getContextType();
GrContextFactory::ContextOverrides contextOverrides = gpuConfig->getContextOverrides();
- GrContextFactory testFactory;
+ GrContextFactory testFactory(grCtxOptions);
if (!testFactory.get(contextType, contextOverrides)) {
info("WARNING: can not create GPU context for config '%s'. "
"GM tests will be skipped.\n", gpuConfig->getTag().c_str());
@@ -911,12 +916,12 @@ static Sink* create_via(const SkString& tag, Sink* wrapped) {
return nullptr;
}
-static bool gather_sinks() {
+static bool gather_sinks(const GrContextOptions& grCtxOptions) {
SkCommandLineConfigArray configs;
ParseConfigs(FLAGS_config, &configs);
for (int i = 0; i < configs.count(); i++) {
const SkCommandLineConfig& config = *configs[i];
- Sink* sink = create_sink(&config);
+ Sink* sink = create_sink(grCtxOptions, &config);
if (sink == nullptr) {
info("Skipping config %s: Don't understand '%s'.\n", config.getTag().c_str(),
config.getTag().c_str());
@@ -1233,7 +1238,7 @@ static void gather_tests() {
}
}
-static void run_test(skiatest::Test test) {
+static void run_test(skiatest::Test test, const GrContextOptions& grCtxOptions) {
struct : public skiatest::Reporter {
void reportFailed(const skiatest::Failure& failure) override {
fail(failure.toString());
@@ -1247,7 +1252,7 @@ static void run_test(skiatest::Test test) {
if (!FLAGS_dryRun && !is_blacklisted("_", "tests", "_", test.name)) {
start("unit", "test", "", test.name);
- GrContextFactory factory;
+ GrContextFactory factory(grCtxOptions);
test.proc(&reporter, &factory);
}
done("unit", "test", "", test.name);
@@ -1307,6 +1312,11 @@ int main(int argc, char** argv) {
gVLog = fopen(SkOSPath::Join(FLAGS_writePath[0], "verbose.log").c_str(), "w");
}
+ GrContextOptions grCtxOptions;
+#if SK_SUPPORT_GPU
+ grCtxOptions.fGpuPathRenderers = CollectGpuPathRenderersFromFlags();
+#endif
+
JsonWriter::DumpJson(); // It's handy for the bots to assume this is ~never missing.
SkAutoGraphics ag;
SkTaskGroup::Enabler enabled(FLAGS_threads);
@@ -1325,7 +1335,7 @@ int main(int argc, char** argv) {
if (!gather_srcs()) {
return 1;
}
- if (!gather_sinks()) {
+ if (!gather_sinks(grCtxOptions)) {
return 1;
}
gather_tests();
@@ -1356,12 +1366,12 @@ int main(int argc, char** argv) {
}
}
for (auto test : gParallelTests) {
- parallel.add([test] { run_test(test); });
+ parallel.add([test, grCtxOptions] { run_test(test, grCtxOptions); });
}
// With the parallel work running, run serial tasks and tests here on main thread.
for (auto task : serial) { Task::Run(task); }
- for (auto test : gSerialTests) { run_test(test); }
+ for (auto test : gSerialTests) { run_test(test, grCtxOptions); }
// Wait for any remaining parallel work to complete (including any spun off of serial tasks).
parallel.wait();