aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorGravatar Brian Salomon <bsalomon@google.com>2017-03-27 13:09:36 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-03-27 17:45:29 +0000
commitc0b642ca48d58416409e555549434066f09692b7 (patch)
tree42de3fb562c64c5bd22f9f7622ba8ae699ad3e08 /tests
parent88f9c1eff96a12cfa42db5c238ed42623762d90c (diff)
Split GrPipelineInput into separate color and coverage types, the latter of which is just an enum.
Assign names that indicate that they aren't just for the input phase since I plan to use them at the boundary between FPs and XPs as well. Renamed GrProcOptInfo to GrColorFragmentProcessorAnalysis. This is now only used on the color side and the new name seems clearer to me. Change GrMeshDrawOp::getFragmentProcessorAnalysisInputs to use the new color/coverage types directly rather than a class that has been reduced to simply bundling them together. Change-Id: If93bae74c9d590486eecdf63f302418c96deab65 Reviewed-on: https://skia-review.googlesource.com/10161 Commit-Queue: Brian Salomon <bsalomon@google.com> Reviewed-by: Greg Daniel <egdaniel@google.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/GrPorterDuffTest.cpp56
-rw-r--r--tests/PreFlushCallbackTest.cpp7
-rw-r--r--tests/PrimitiveProcessorTest.cpp7
3 files changed, 33 insertions, 37 deletions
diff --git a/tests/GrPorterDuffTest.cpp b/tests/GrPorterDuffTest.cpp
index de1843813a..ef217010ae 100644
--- a/tests/GrPorterDuffTest.cpp
+++ b/tests/GrPorterDuffTest.cpp
@@ -93,13 +93,11 @@ public:
};
static void test_lcd_coverage(skiatest::Reporter* reporter, const GrCaps& caps) {
- GrPipelineInput lcdInput;
- lcdInput.setToLCDCoverage();
- GrProcessorSet::FragmentProcessorAnalysis analysis(GrPipelineInput(), lcdInput, caps);
-
+ GrProcessorSet::FragmentProcessorAnalysis analysis(GrPipelineAnalysisColor(),
+ GrPipelineAnalysisCoverage::kLCD, caps);
SkASSERT(!analysis.isOutputColorOpaque());
SkASSERT(!analysis.hasKnownOutputColor());
- SkASSERT(analysis.hasLCDCoverage());
+ SkASSERT(analysis.outputCoverageType() == GrPipelineAnalysisCoverage::kLCD);
for (int m = 0; m <= (int)SkBlendMode::kLastCoeffMode; m++) {
SkBlendMode xfermode = static_cast<SkBlendMode>(m);
@@ -263,12 +261,12 @@ static void test_lcd_coverage(skiatest::Reporter* reporter, const GrCaps& caps)
}
}
static void test_color_unknown_with_coverage(skiatest::Reporter* reporter, const GrCaps& caps) {
- GrProcessorSet::FragmentProcessorAnalysis analysis(GrPipelineInput(), GrPipelineInput(), caps);
+ GrProcessorSet::FragmentProcessorAnalysis analysis(
+ GrPipelineAnalysisColor(), GrPipelineAnalysisCoverage::kSingleChannel, caps);
SkASSERT(!analysis.isOutputColorOpaque());
SkASSERT(!analysis.hasKnownOutputColor());
- SkASSERT(!analysis.hasLCDCoverage());
- SkASSERT(analysis.hasCoverage());
+ SkASSERT(analysis.outputCoverageType() == GrPipelineAnalysisCoverage::kSingleChannel);
for (int m = 0; m <= (int)SkBlendMode::kLastCoeffMode; m++) {
SkBlendMode xfermode = static_cast<SkBlendMode>(m);
@@ -434,7 +432,7 @@ static void test_color_unknown_with_coverage(skiatest::Reporter* reporter, const
static void test_color_unknown_no_coverage(skiatest::Reporter* reporter, const GrCaps& caps) {
GrProcessorSet::FragmentProcessorAnalysis analysis(GrColorPackRGBA(229, 0, 154, 240),
- GrColorPackA4(255), caps);
+ GrPipelineAnalysisCoverage::kNone, caps);
SkASSERT(!analysis.isOutputColorOpaque());
SkASSERT(analysis.hasKnownOutputColor());
@@ -603,13 +601,13 @@ static void test_color_unknown_no_coverage(skiatest::Reporter* reporter, const G
}
static void test_color_opaque_with_coverage(skiatest::Reporter* reporter, const GrCaps& caps) {
- GrProcessorSet::FragmentProcessorAnalysis analysis(GrPipelineInput::Opaque::kYes,
- GrPipelineInput(), caps);
+ GrProcessorSet::FragmentProcessorAnalysis analysis(GrPipelineAnalysisColor::Opaque::kYes,
+ GrPipelineAnalysisCoverage::kSingleChannel,
+ caps);
SkASSERT(analysis.isOutputColorOpaque());
SkASSERT(!analysis.hasKnownOutputColor());
- SkASSERT(analysis.hasCoverage());
- SkASSERT(!analysis.hasLCDCoverage());
+ SkASSERT(analysis.outputCoverageType() == GrPipelineAnalysisCoverage::kSingleChannel);
for (int m = 0; m <= (int)SkBlendMode::kLastCoeffMode; m++) {
SkBlendMode xfermode = static_cast<SkBlendMode>(m);
@@ -775,8 +773,8 @@ static void test_color_opaque_with_coverage(skiatest::Reporter* reporter, const
}
static void test_color_opaque_no_coverage(skiatest::Reporter* reporter, const GrCaps& caps) {
- GrProcessorSet::FragmentProcessorAnalysis analysis(GrPipelineInput::Opaque::kYes,
- GrColorPackA4(255), caps);
+ GrProcessorSet::FragmentProcessorAnalysis analysis(GrPipelineAnalysisColor::Opaque::kYes,
+ GrPipelineAnalysisCoverage::kNone, caps);
SkASSERT(analysis.isOutputColorOpaque());
SkASSERT(!analysis.hasKnownOutputColor());
@@ -957,9 +955,10 @@ static void test_lcd_coverage_fallback_case(skiatest::Reporter* reporter, const
private:
void getFragmentProcessorAnalysisInputs(
- FragmentProcessorAnalysisInputs* input) const override {
- input->colorInput()->setToConstant(GrColorPackRGBA(123, 45, 67, 221));
- input->coverageInput()->setToLCDCoverage();
+ GrPipelineAnalysisColor* color,
+ GrPipelineAnalysisCoverage* coverage) const override {
+ color->setToConstant(GrColorPackRGBA(123, 45, 67, 221));
+ *coverage = GrPipelineAnalysisCoverage::kLCD;
}
void applyPipelineOptimizations(const GrPipelineOptimizations&) override {}
@@ -973,7 +972,7 @@ static void test_lcd_coverage_fallback_case(skiatest::Reporter* reporter, const
testLCDCoverageOp.analyzeProcessors(&analysis, GrProcessorSet(GrPaint()), nullptr, caps);
SkASSERT(analysis.hasKnownOutputColor());
- SkASSERT(analysis.hasLCDCoverage());
+ SkASSERT(analysis.outputCoverageType() == GrPipelineAnalysisCoverage::kLCD);
const GrXPFactory* xpf = GrPorterDuffXPFactory::Get(SkBlendMode::kSrcOver);
TEST_ASSERT(!GrXPFactory::WillNeedDstTexture(xpf, caps, analysis));
@@ -1017,21 +1016,16 @@ DEF_GPUTEST(PorterDuffNoDualSourceBlending, reporter, /*factory*/) {
fakeDstTexture.setTexture(
ctx->resourceProvider()->wrapBackendTexture(fakeDesc, kBorrow_GrWrapOwnership));
- static const GrPipelineInput colorInputs[] = {GrPipelineInput(),
- GrPipelineInput(GrPipelineInput::Opaque::kYes),
- GrPipelineInput(GrColorPackRGBA(0, 82, 17, 100)),
- GrPipelineInput(GrColorPackRGBA(0, 82, 17, 255))};
+ static const GrPipelineAnalysisColor colorInputs[] = {
+ GrPipelineAnalysisColor::Opaque::kNo, GrPipelineAnalysisColor::Opaque::kYes,
+ GrPipelineAnalysisColor(GrColorPackRGBA(0, 82, 17, 100)),
+ GrPipelineAnalysisColor(GrColorPackRGBA(0, 82, 17, 255))};
for (const auto& colorInput : colorInputs) {
GrProcessorSet::FragmentProcessorAnalysis analysis;
- for (bool fractionalCoverage : {true, false}) {
- if (fractionalCoverage) {
- analysis = GrProcessorSet::FragmentProcessorAnalysis(colorInput, GrPipelineInput(),
- caps);
- } else {
- analysis = GrProcessorSet::FragmentProcessorAnalysis(colorInput, GrColorPackA4(255),
- caps);
- }
+ for (GrPipelineAnalysisCoverage coverageType :
+ {GrPipelineAnalysisCoverage::kSingleChannel, GrPipelineAnalysisCoverage::kNone}) {
+ analysis = GrProcessorSet::FragmentProcessorAnalysis(colorInput, coverageType, caps);
for (int m = 0; m <= (int)SkBlendMode::kLastCoeffMode; m++) {
SkBlendMode xfermode = static_cast<SkBlendMode>(m);
const GrXPFactory* xpf = GrPorterDuffXPFactory::Get(xfermode);
diff --git a/tests/PreFlushCallbackTest.cpp b/tests/PreFlushCallbackTest.cpp
index 773cfde347..e008009efd 100644
--- a/tests/PreFlushCallbackTest.cpp
+++ b/tests/PreFlushCallbackTest.cpp
@@ -64,9 +64,10 @@ protected:
SkRect fRect;
private:
- void getFragmentProcessorAnalysisInputs(FragmentProcessorAnalysisInputs* input) const override {
- input->colorInput()->setToUnknown();
- input->coverageInput()->setToUnknown();
+ void getFragmentProcessorAnalysisInputs(GrPipelineAnalysisColor* color,
+ GrPipelineAnalysisCoverage* coverage) const override {
+ color->setToUnknown();
+ *coverage = GrPipelineAnalysisCoverage::kSingleChannel;
}
void applyPipelineOptimizations(const GrPipelineOptimizations& optimizations) override {
diff --git a/tests/PrimitiveProcessorTest.cpp b/tests/PrimitiveProcessorTest.cpp
index 30bfed9ff0..0a9d0021f0 100644
--- a/tests/PrimitiveProcessorTest.cpp
+++ b/tests/PrimitiveProcessorTest.cpp
@@ -40,9 +40,10 @@ private:
this->setBounds(SkRect::MakeWH(1.f, 1.f), HasAABloat::kNo, IsZeroArea::kNo);
}
- void getFragmentProcessorAnalysisInputs(FragmentProcessorAnalysisInputs* input) const override {
- input->colorInput()->setToUnknown();
- input->coverageInput()->setToUnknown();
+ void getFragmentProcessorAnalysisInputs(GrPipelineAnalysisColor* color,
+ GrPipelineAnalysisCoverage* coverage) const override {
+ color->setToUnknown();
+ *coverage = GrPipelineAnalysisCoverage::kSingleChannel;
}
void applyPipelineOptimizations(const GrPipelineOptimizations&) override {}