aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/ProcessorTest.cpp
diff options
context:
space:
mode:
authorGravatar Brian Salomon <bsalomon@google.com>2017-07-31 16:27:23 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-07-31 20:51:42 +0000
commit96271cd1805d55b1a985652eebd0399ebe415283 (patch)
tree951bef0f222b0eb3c087901cd810f805593e5965 /tests/ProcessorTest.cpp
parentf3ce7e3c673fd4ace2ca56effe4cfd2908919b9d (diff)
Require clone() be implemented by GrFragmentProcessor subclasses
Change-Id: I66ba0978e5748806d563ff4f26000e4e0095ed24 Reviewed-on: https://skia-review.googlesource.com/29042 Reviewed-by: Ethan Nicholas <ethannicholas@google.com> Commit-Queue: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'tests/ProcessorTest.cpp')
-rw-r--r--tests/ProcessorTest.cpp18
1 files changed, 5 insertions, 13 deletions
diff --git a/tests/ProcessorTest.cpp b/tests/ProcessorTest.cpp
index 3bfd62e3a4..e2625a7e31 100644
--- a/tests/ProcessorTest.cpp
+++ b/tests/ProcessorTest.cpp
@@ -84,15 +84,7 @@ public:
}
sk_sp<GrFragmentProcessor> clone() const override {
- sk_sp<GrFragmentProcessor> child;
- if (this->numChildProcessors()) {
- SkASSERT(1 == this->numChildProcessors());
- child = this->childProcessor(0).clone();
- if (!child) {
- return nullptr;
- }
- }
- return sk_sp<GrFragmentProcessor> (new TestFP(*this, std::move(child)));
+ return sk_sp<GrFragmentProcessor>(new TestFP(*this));
}
private:
@@ -120,7 +112,7 @@ private:
this->registerChildProcessor(std::move(child));
}
- explicit TestFP(const TestFP& that, sk_sp<GrFragmentProcessor> child)
+ explicit TestFP(const TestFP& that)
: INHERITED(that.optimizationFlags()), fSamplers(4), fBuffers(4), fImages(4) {
this->initClassID<TestFP>();
for (int i = 0; i < that.fSamplers.count(); ++i) {
@@ -135,8 +127,8 @@ private:
fImages.emplace_back(that.fImages[i]);
this->addImageStorageAccess(&fImages.back());
}
- if (child) {
- this->registerChildProcessor(std::move(child));
+ for (int i = 0; i < that.numChildProcessors(); ++i) {
+ this->registerChildProcessor(that.childProcessor(i).clone());
}
}
@@ -554,8 +546,8 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ProcessorCloneTest, reporter, ctxInfo) {
for (int j = 0; j < kTimesToInvokeFactory; ++j) {
auto fp = GrFragmentProcessorTestFactory::MakeIdx(i, &testData);
auto clone = fp->clone();
- // Currently clone() is allowed to fail.
if (!clone) {
+ ERRORF(reporter, "Clone of processor %s failed.", fp->name());
continue;
}
if (!fp->instantiate(context->resourceProvider()) ||