Update existing TestCreate methods to honor the inputFP in the TestData.
This can be leveraged to build chains of test FPs in a controlled way.
At present, `inputFP` it is never set to anything other than null; as
such, all calls to TestCreate continue to set a null inputFP
(exactly as they do already).
Change-Id: I0d74f37a076ca338e44ff734816299beb1667c26
Bug: skia:10384
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/302668
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
diff --git a/src/gpu/GrProcessorUnitTest.cpp b/src/gpu/GrProcessorUnitTest.cpp
index 18f09ad..1d6aef9 100644
--- a/src/gpu/GrProcessorUnitTest.cpp
+++ b/src/gpu/GrProcessorUnitTest.cpp
@@ -13,11 +13,10 @@
#if GR_TEST_UTILS
-GrProcessorTestData::GrProcessorTestData(SkRandom* random,
- GrRecordingContext* context,
- int numViews,
- const ViewInfo views[])
- : fRandom(random), fContext(context) {
+GrProcessorTestData::GrProcessorTestData(SkRandom* random, GrRecordingContext* context,
+ int numViews, const ViewInfo views[],
+ std::unique_ptr<GrFragmentProcessor> inputFP)
+ : fRandom(random), fContext(context), fInputFP(std::move(inputFP)) {
fViews.reset(views, numViews);
fArena = std::unique_ptr<SkArenaAlloc>(new SkArenaAlloc(1000));
}
@@ -28,6 +27,8 @@
const GrCaps* GrProcessorTestData::caps() { return fContext->priv().caps(); }
+std::unique_ptr<GrFragmentProcessor> GrProcessorTestData::inputFP() { return std::move(fInputFP); }
+
GrProcessorTestData::ViewInfo GrProcessorTestData::randomView() {
SkASSERT(!fViews.empty());
return fViews[fRandom->nextULessThan(fViews.count())];