aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorGravatar Brian Salomon <bsalomon@google.com>2017-03-29 14:25:04 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-03-29 19:05:06 +0000
commit1c6025cc9da4a4f3a8ad16dde2ae8dcf120ed270 (patch)
treef9d56e3c06726f2b1e69a6532a301b2dd1621533 /tests
parent978533c302bc53a26980c96f8a348ae7eb9e3862 (diff)
Make analysis optional to GrPipeline::init().
GrXPFactory::createXferProcessor now takes GrPipelineAnalysisColor and GrPipelineAnalysisCoverage rather than GrProcessorSet::FragmentProcessorAnalysis. This will make it so ops do not have to retain the analysis or rerun it to create pipelines at flush time. Change-Id: Ib28ba65de425b20c2647329275f209aec168c3df Reviewed-on: https://skia-review.googlesource.com/10474 Commit-Queue: Brian Salomon <bsalomon@google.com> Reviewed-by: Greg Daniel <egdaniel@google.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/GpuSampleLocationsTest.cpp2
-rw-r--r--tests/GrPorterDuffTest.cpp44
2 files changed, 9 insertions, 37 deletions
diff --git a/tests/GpuSampleLocationsTest.cpp b/tests/GpuSampleLocationsTest.cpp
index 5cb9b606db..75fa6fcf65 100644
--- a/tests/GpuSampleLocationsTest.cpp
+++ b/tests/GpuSampleLocationsTest.cpp
@@ -96,11 +96,9 @@ static void construct_dummy_pipeline(GrRenderTargetContext* dc, GrPipeline* pipe
GrScissorState dummyScissor;
GrWindowRectsState dummyWindows;
- GrProcessorSet::FragmentProcessorAnalysis analysis;
GrPipeline::InitArgs args;
dummyBuilder.getPipelineInitArgs(&args);
args.fRenderTarget = dc->accessRenderTarget();
- args.fAnalysis = &analysis;
args.fCaps = dc->caps();
args.fDstTexture = GrXferProcessor::DstTexture();
pipeline->init(args);
diff --git a/tests/GrPorterDuffTest.cpp b/tests/GrPorterDuffTest.cpp
index 0170488158..9268dd4d0b 100644
--- a/tests/GrPorterDuffTest.cpp
+++ b/tests/GrPorterDuffTest.cpp
@@ -66,7 +66,8 @@ public:
fCompatibleWithCoverageAsAlpha = analysis.isCompatibleWithCoverageAsAlpha();
fCanCombineOverlappedStencilAndCover = analysis.canCombineOverlappedStencilAndCover();
fIgnoresInputColor = analysis.isInputColorIgnored();
- sk_sp<GrXferProcessor> xp(xpf->createXferProcessor(analysis, false, nullptr, caps));
+ sk_sp<GrXferProcessor> xp(
+ xpf->createXferProcessor(inputColor, inputCoverage, false, nullptr, caps));
TEST_ASSERT(!analysis.requiresDstTexture());
GetXPOutputTypes(xp.get(), &fPrimaryOutputType, &fSecondaryOutputType);
xp->getBlendInfo(&fBlendInfo);
@@ -987,39 +988,12 @@ static void test_color_opaque_no_coverage(skiatest::Reporter* reporter, const Gr
}
static void test_lcd_coverage_fallback_case(skiatest::Reporter* reporter, const GrCaps& caps) {
- class TestLCDCoverageOp : public GrMeshDrawOp {
- public:
- DEFINE_OP_CLASS_ID
-
- TestLCDCoverageOp() : INHERITED(ClassID()) {}
-
- const char* name() const override { return "Test LCD Text Op"; }
-
- private:
- void getFragmentProcessorAnalysisInputs(
- GrPipelineAnalysisColor* color,
- GrPipelineAnalysisCoverage* coverage) const override {
- color->setToConstant(GrColorPackRGBA(123, 45, 67, 221));
- *coverage = GrPipelineAnalysisCoverage::kLCD;
- }
-
- void applyPipelineOptimizations(const PipelineOptimizations&) override {}
- bool onCombineIfPossible(GrOp*, const GrCaps&) override { return false; }
- void onPrepareDraws(Target*) const override {}
-
- typedef GrMeshDrawOp INHERITED;
- } testLCDCoverageOp;
-
- GrProcessorSet::FragmentProcessorAnalysis analysis;
- testLCDCoverageOp.analyzeProcessors(&analysis, GrProcessorSet(GrPaint()), nullptr, caps);
-
- SkASSERT(analysis.hasKnownOutputColor());
- SkASSERT(analysis.outputCoverageType() == GrPipelineAnalysisCoverage::kLCD);
-
- TEST_ASSERT(!analysis.requiresDstTexture());
-
const GrXPFactory* xpf = GrPorterDuffXPFactory::Get(SkBlendMode::kSrcOver);
- sk_sp<GrXferProcessor> xp(xpf->createXferProcessor(analysis, false, nullptr, caps));
+ GrPipelineAnalysisColor color = GrColorPackRGBA(123, 45, 67, 221);
+ GrPipelineAnalysisCoverage coverage = GrPipelineAnalysisCoverage::kLCD;
+ SkASSERT(!(GrXPFactory::GetAnalysisProperties(xpf, color, coverage, caps) &
+ GrXPFactory::AnalysisProperties::kRequiresDstTexture));
+ sk_sp<GrXferProcessor> xp(xpf->createXferProcessor(color, coverage, false, nullptr, caps));
if (!xp) {
ERRORF(reporter, "Failed to create an XP with LCD coverage.");
return;
@@ -1072,8 +1046,8 @@ DEF_GPUTEST(PorterDuffNoDualSourceBlending, reporter, /*factory*/) {
caps);
GrXferProcessor::DstTexture* dstTexture =
analysis.requiresDstTexture() ? &fakeDstTexture : nullptr;
- sk_sp<GrXferProcessor> xp(
- xpf->createXferProcessor(analysis, false, dstTexture, caps));
+ sk_sp<GrXferProcessor> xp(xpf->createXferProcessor(colorInput, coverageType, false,
+ dstTexture, caps));
if (!xp) {
ERRORF(reporter, "Failed to create an XP without dual source blending.");
return;