From 9a725dd9485654155e2e4196c32d372360bcdb61 Mon Sep 17 00:00:00 2001 From: Brian Osman Date: Wed, 20 Sep 2017 09:53:22 -0400 Subject: Use shader based blending to clamp kPlus mode w/F16 Bug: skia:6173 Change-Id: I21042d484d9a7b3eee04aa3301d9793d00ad6908 Reviewed-on: https://skia-review.googlesource.com/48183 Reviewed-by: Brian Salomon Commit-Queue: Brian Osman --- tests/GrPorterDuffTest.cpp | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'tests/GrPorterDuffTest.cpp') diff --git a/tests/GrPorterDuffTest.cpp b/tests/GrPorterDuffTest.cpp index 096219bb9a..073bdf0667 100644 --- a/tests/GrPorterDuffTest.cpp +++ b/tests/GrPorterDuffTest.cpp @@ -66,7 +66,8 @@ static GrProcessorSet::Analysis do_analysis(const GrXPFactory* xpf, GrProcessorSet procs(std::move(paint)); GrColor overrideColor; GrProcessorSet::Analysis analysis = - procs.finalize(colorInput, coverageInput, nullptr, false, caps, &overrideColor); + procs.finalize(colorInput, coverageInput, nullptr, false, caps, + GrPixelConfigIsClamped::kYes, &overrideColor); return analysis; } @@ -84,7 +85,8 @@ public: fCanCombineOverlappedStencilAndCover = analysis.canCombineOverlappedStencilAndCover(); fIgnoresInputColor = analysis.inputColorIsIgnored(); sk_sp xp( - GrXPFactory::MakeXferProcessor(xpf, inputColor, inputCoverage, false, caps)); + GrXPFactory::MakeXferProcessor(xpf, inputColor, inputCoverage, false, caps, + GrPixelConfigIsClamped::kYes)); TEST_ASSERT(!analysis.requiresDstTexture() || (isLCD && !caps.shaderCaps()->dstReadInShaderSupport() && @@ -1015,10 +1017,12 @@ static void test_lcd_coverage_fallback_case(skiatest::Reporter* reporter, const const GrXPFactory* xpf = GrPorterDuffXPFactory::Get(SkBlendMode::kSrcOver); GrProcessorAnalysisColor color = GrColorPackRGBA(123, 45, 67, 255); GrProcessorAnalysisCoverage coverage = GrProcessorAnalysisCoverage::kLCD; - TEST_ASSERT(!(GrXPFactory::GetAnalysisProperties(xpf, color, coverage, caps) & + TEST_ASSERT(!(GrXPFactory::GetAnalysisProperties(xpf, color, coverage, caps, + GrPixelConfigIsClamped::kYes) & GrXPFactory::AnalysisProperties::kRequiresDstTexture)); sk_sp xp_opaque( - GrXPFactory::MakeXferProcessor(xpf, color, coverage, false, caps)); + GrXPFactory::MakeXferProcessor(xpf, color, coverage, false, caps, + GrPixelConfigIsClamped::kYes)); if (!xp_opaque) { ERRORF(reporter, "Failed to create an XP with LCD coverage."); return; @@ -1031,10 +1035,12 @@ static void test_lcd_coverage_fallback_case(skiatest::Reporter* reporter, const // Test with non-opaque alpha color = GrColorPackRGBA(123, 45, 67, 221); coverage = GrProcessorAnalysisCoverage::kLCD; - TEST_ASSERT(!(GrXPFactory::GetAnalysisProperties(xpf, color, coverage, caps) & + TEST_ASSERT(!(GrXPFactory::GetAnalysisProperties(xpf, color, coverage, caps, + GrPixelConfigIsClamped::kYes) & GrXPFactory::AnalysisProperties::kRequiresDstTexture)); sk_sp xp( - GrXPFactory::MakeXferProcessor(xpf, color, coverage, false, caps)); + GrXPFactory::MakeXferProcessor(xpf, color, coverage, false, caps, + GrPixelConfigIsClamped::kYes)); if (!xp) { ERRORF(reporter, "Failed to create an XP with LCD coverage."); return; @@ -1087,7 +1093,8 @@ DEF_GPUTEST(PorterDuffNoDualSourceBlending, reporter, /*factory*/) { SkBlendMode xfermode = static_cast(m); const GrXPFactory* xpf = GrPorterDuffXPFactory::Get(xfermode); sk_sp xp( - GrXPFactory::MakeXferProcessor(xpf, colorInput, coverageType, false, caps)); + GrXPFactory::MakeXferProcessor(xpf, colorInput, coverageType, false, caps, + GrPixelConfigIsClamped::kYes)); if (!xp) { ERRORF(reporter, "Failed to create an XP without dual source blending."); return; -- cgit v1.2.3