Revert of Fix LCD coverage regression in GrPorterDuffXPFactory (patchset #3 id:40001 of https://codereview.chromium.org/1149883004/)
Reason for revert: Reverting this fix to revert https://codereview.chromium.org/1124373002 Original issue's description: > Fix LCD coverage regression in GrPorterDuffXPFactory > > Fixes GrPorterDuffXPFactory to not use the blend table when getting > info about the LCD coverage XP. > > BUG=skia: > > Committed: https://skia.googlesource.com/skia/+/3e2d59ef36e1b9a63e524cf1b27d5f7bcfb5ff0b TBR=bsalomon@google.com,egdaniel@google.com,cdalton@nvidia.com NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=skia: Review URL: https://codereview.chromium.org/1153803005
This commit is contained in:
parent
aa999cb952
commit
c319c80d09
@ -744,16 +744,11 @@ bool GrPorterDuffXPFactory::supportsRGBCoverage(GrColor /*knownColor*/,
|
||||
void GrPorterDuffXPFactory::getInvariantOutput(const GrProcOptInfo& colorPOI,
|
||||
const GrProcOptInfo& coveragePOI,
|
||||
GrXPFactory::InvariantOutput* output) const {
|
||||
output->fWillBlendWithDst = true;
|
||||
output->fBlendedColorFlags = kNone_GrColorComponentFlags;
|
||||
|
||||
// The LCD coverage XP doesn't use the blend table, and has no invariant output.
|
||||
if (coveragePOI.isFourChannelOutput()) {
|
||||
return;
|
||||
}
|
||||
|
||||
const BlendFormula& blendFormula = get_blend_formula(fXfermode, colorPOI, coveragePOI);
|
||||
|
||||
if (blendFormula.usesDstColor()) {
|
||||
output->fWillBlendWithDst = true;
|
||||
output->fBlendedColorFlags = kNone_GrColorComponentFlags;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -773,18 +768,16 @@ void GrPorterDuffXPFactory::getInvariantOutput(const GrProcOptInfo& colorPOI,
|
||||
output->fBlendedColorFlags = colorPOI.validFlags();
|
||||
return;
|
||||
|
||||
default: return;
|
||||
// TODO: update if we ever use const color.
|
||||
default:
|
||||
output->fBlendedColorFlags = kNone_GrColorComponentFlags;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
bool GrPorterDuffXPFactory::willReadDstColor(const GrCaps& caps,
|
||||
const GrProcOptInfo& colorPOI,
|
||||
const GrProcOptInfo& coveragePOI) const {
|
||||
// The LCD coverage XP doesn't use the blend table, and never requires a dst read.
|
||||
if (coveragePOI.isFourChannelOutput()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Some formulas use dual source blending, so we fall back if it is required but not supported.
|
||||
return !caps.shaderCaps()->dualSourceBlendingSupport() &&
|
||||
get_blend_formula(fXfermode, colorPOI, coveragePOI).hasSecondaryOutput();
|
||||
|
@ -10,7 +10,6 @@
|
||||
|
||||
#if SK_SUPPORT_GPU
|
||||
|
||||
#include "GrBatch.h"
|
||||
#include "GrContextFactory.h"
|
||||
#include "GrGpu.h"
|
||||
#include "GrXferProcessor.h"
|
||||
@ -24,7 +23,6 @@ static void test_alpha_opaque_with_coverage(skiatest::Reporter* reporter, const
|
||||
static void test_alpha_opaque_no_coverage(skiatest::Reporter* reporter, const GrCaps& caps);
|
||||
static void test_color_white_with_coverage(skiatest::Reporter* reporter, const GrCaps& caps);
|
||||
static void test_color_white_no_coverage(skiatest::Reporter* reporter, const GrCaps& caps);
|
||||
static void test_lcd_coverage(skiatest::Reporter* reporter, const GrCaps& caps);
|
||||
|
||||
DEF_GPUTEST(GrPorterDuff, reporter, factory) {
|
||||
GrContext* ctx = factory->get(GrContextFactory::kNull_GLContextType);
|
||||
@ -46,7 +44,6 @@ DEF_GPUTEST(GrPorterDuff, reporter, factory) {
|
||||
test_color_white_with_coverage(reporter, caps);
|
||||
test_color_white_with_coverage(reporter, caps);
|
||||
test_color_white_no_coverage(reporter, caps);
|
||||
test_lcd_coverage(reporter, caps);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@ -103,7 +100,6 @@ static void test_alpha_unknown_with_coverage(skiatest::Reporter* reporter, const
|
||||
SkASSERT(!colorPOI.isOpaque());
|
||||
SkASSERT(!colorPOI.isSolidWhite());
|
||||
SkASSERT(!covPOI.isSolidWhite());
|
||||
SkASSERT(!covPOI.isFourChannelOutput());
|
||||
|
||||
for (int m = 0; m <= SkXfermode::kLastCoeffMode; m++) {
|
||||
SkXfermode::Mode xfermode = static_cast<SkXfermode::Mode>(m);
|
||||
@ -294,7 +290,6 @@ static void test_alpha_unknown_no_coverage(skiatest::Reporter* reporter, const G
|
||||
SkASSERT(!colorPOI.isOpaque());
|
||||
SkASSERT(!colorPOI.isSolidWhite());
|
||||
SkASSERT(covPOI.isSolidWhite());
|
||||
SkASSERT(!covPOI.isFourChannelOutput());
|
||||
|
||||
for (int m = 0; m <= SkXfermode::kLastCoeffMode; m++) {
|
||||
SkXfermode::Mode xfermode = static_cast<SkXfermode::Mode>(m);
|
||||
@ -496,7 +491,6 @@ static void test_alpha_opaque_with_coverage(skiatest::Reporter* reporter, const
|
||||
SkASSERT(colorPOI.isOpaque());
|
||||
SkASSERT(!colorPOI.isSolidWhite());
|
||||
SkASSERT(!covPOI.isSolidWhite());
|
||||
SkASSERT(!covPOI.isFourChannelOutput());
|
||||
|
||||
for (int m = 0; m <= SkXfermode::kLastCoeffMode; m++) {
|
||||
SkXfermode::Mode xfermode = static_cast<SkXfermode::Mode>(m);
|
||||
@ -690,7 +684,6 @@ static void test_alpha_opaque_no_coverage(skiatest::Reporter* reporter, const Gr
|
||||
SkASSERT(colorPOI.isOpaque());
|
||||
SkASSERT(!colorPOI.isSolidWhite());
|
||||
SkASSERT(covPOI.isSolidWhite());
|
||||
SkASSERT(!covPOI.isFourChannelOutput());
|
||||
|
||||
for (int m = 0; m <= SkXfermode::kLastCoeffMode; m++) {
|
||||
SkXfermode::Mode xfermode = static_cast<SkXfermode::Mode>(m);
|
||||
@ -897,7 +890,6 @@ static void test_color_white_with_coverage(skiatest::Reporter* reporter, const G
|
||||
SkASSERT(colorPOI.isOpaque());
|
||||
SkASSERT(colorPOI.isSolidWhite());
|
||||
SkASSERT(!covPOI.isSolidWhite());
|
||||
SkASSERT(!covPOI.isFourChannelOutput());
|
||||
|
||||
for (int m = 0; m <= SkXfermode::kLastCoeffMode; m++) {
|
||||
SkXfermode::Mode xfermode = static_cast<SkXfermode::Mode>(m);
|
||||
@ -1090,7 +1082,6 @@ static void test_color_white_no_coverage(skiatest::Reporter* reporter, const GrC
|
||||
SkASSERT(colorPOI.isOpaque());
|
||||
SkASSERT(colorPOI.isSolidWhite());
|
||||
SkASSERT(covPOI.isSolidWhite());
|
||||
SkASSERT(!covPOI.isFourChannelOutput());
|
||||
|
||||
for (int m = 0; m <= SkXfermode::kLastCoeffMode; m++) {
|
||||
SkXfermode::Mode xfermode = static_cast<SkXfermode::Mode>(m);
|
||||
@ -1285,52 +1276,5 @@ static void test_color_white_no_coverage(skiatest::Reporter* reporter, const GrC
|
||||
}
|
||||
}
|
||||
|
||||
static void test_lcd_coverage(skiatest::Reporter* reporter, const GrCaps& caps) {
|
||||
class : public GrBatch {
|
||||
void getInvariantOutputColor(GrInitInvariantOutput* out) const override {
|
||||
out->setKnownFourComponents(GrColorPackRGBA(123, 45, 67, 221));
|
||||
}
|
||||
|
||||
void getInvariantOutputCoverage(GrInitInvariantOutput* out) const override {
|
||||
out->setUnknownFourComponents();
|
||||
out->setUsingLCDCoverage();
|
||||
}
|
||||
|
||||
const char* name() const override { return "Test LCD Text Batch"; }
|
||||
void initBatchTracker(const GrPipelineInfo&) override {}
|
||||
bool onCombineIfPossible(GrBatch*) override { return false; }
|
||||
void generateGeometry(GrBatchTarget*, const GrPipeline*) override {}
|
||||
|
||||
} testLCDCoverageBatch;
|
||||
|
||||
GrProcOptInfo colorPOI, covPOI;
|
||||
colorPOI.calcColorWithBatch(&testLCDCoverageBatch, NULL, 0);
|
||||
covPOI.calcCoverageWithBatch(&testLCDCoverageBatch, NULL, 0);
|
||||
|
||||
SkASSERT(kRGBA_GrColorComponentFlags == colorPOI.validFlags());
|
||||
SkASSERT(covPOI.isFourChannelOutput());
|
||||
|
||||
SkAutoTUnref<GrXPFactory> xpf(GrPorterDuffXPFactory::Create(SkXfermode::kSrcOver_Mode));
|
||||
TEST_ASSERT(!xpf->willNeedDstCopy(caps, colorPOI, covPOI));
|
||||
|
||||
GrXPFactory::InvariantOutput invariantOutput;
|
||||
xpf->getInvariantOutput(colorPOI, covPOI, &invariantOutput);
|
||||
TEST_ASSERT(invariantOutput.fWillBlendWithDst);
|
||||
TEST_ASSERT(kNone_GrColorComponentFlags == invariantOutput.fBlendedColorFlags);
|
||||
|
||||
SkAutoTUnref<GrXferProcessor> xp(xpf->createXferProcessor(colorPOI, covPOI, 0, caps));
|
||||
if (!xp) {
|
||||
ERRORF(reporter, "Failed to create an XP with LCD coverage.");
|
||||
return;
|
||||
}
|
||||
|
||||
GrColor overrideColor;
|
||||
xp->getOptimizations(colorPOI, covPOI, false, &overrideColor, caps);
|
||||
|
||||
GrXferProcessor::BlendInfo blendInfo;
|
||||
xp->getBlendInfo(&blendInfo);
|
||||
TEST_ASSERT(blendInfo.fWriteColor);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user