Simplify GrProcessorSet by removing multiple color/coverage FP support.
GrProcessorSet is meant to encapsulate the processors in a GrPaint, and
GrPaint no longer supports more than one color or coverage fragment
processor on a paint.
Change-Id: I4334c967e0329503672db3b5510fce1265f25762
Bug: skia:10217
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/304857
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
diff --git a/src/gpu/GrPipeline.cpp b/src/gpu/GrPipeline.cpp
index 351d0a6..ac4869e 100644
--- a/src/gpu/GrPipeline.cpp
+++ b/src/gpu/GrPipeline.cpp
@@ -43,21 +43,21 @@
: GrPipeline(args, processors.refXferProcessor(), appliedClip.hardClip()) {
SkASSERT(processors.isFinalized());
// Copy GrFragmentProcessors from GrProcessorSet to Pipeline
- fNumColorProcessors = processors.numColorFragmentProcessors();
+ fNumColorProcessors = processors.hasColorFragmentProcessor() ? 1 : 0;
int numTotalProcessors = fNumColorProcessors +
- processors.numCoverageFragmentProcessors() +
+ (processors.hasCoverageFragmentProcessor() ? 1 : 0) +
appliedClip.numClipCoverageFragmentProcessors();
fFragmentProcessors.reset(numTotalProcessors);
int currFPIdx = 0;
- for (int i = 0; i < processors.numColorFragmentProcessors(); ++i, ++currFPIdx) {
- fFragmentProcessors[currFPIdx] = processors.detachColorFragmentProcessor(i);
+ if (processors.hasColorFragmentProcessor()) {
+ fFragmentProcessors[currFPIdx++] = processors.detachColorFragmentProcessor();
}
- for (int i = 0; i < processors.numCoverageFragmentProcessors(); ++i, ++currFPIdx) {
- fFragmentProcessors[currFPIdx] = processors.detachCoverageFragmentProcessor(i);
+ if (processors.hasCoverageFragmentProcessor()) {
+ fFragmentProcessors[currFPIdx++] = processors.detachCoverageFragmentProcessor();
}
- for (int i = 0; i < appliedClip.numClipCoverageFragmentProcessors(); ++i, ++currFPIdx) {
- fFragmentProcessors[currFPIdx] = appliedClip.detachClipCoverageFragmentProcessor(i);
+ for (int i = 0; i < appliedClip.numClipCoverageFragmentProcessors(); ++i) {
+ fFragmentProcessors[currFPIdx++] = appliedClip.detachClipCoverageFragmentProcessor(i);
}
}
@@ -88,15 +88,15 @@
// kSnapVerticesToPixelCenters is implemented in a shader.
InputFlags ignoredFlags = InputFlags::kSnapVerticesToPixelCenters;
if (!caps.multisampleDisableSupport()) {
- // Ganesh will omit kHWAntialias regardless multisampleDisableSupport.
+ // Ganesh will omit kHWAntialias regardless of multisampleDisableSupport.
ignoredFlags |= InputFlags::kHWAntialias;
}
b->add32((uint32_t)fFlags & ~(uint32_t)ignoredFlags);
const GrXferProcessor::BlendInfo& blendInfo = this->getXferProcessor().getBlendInfo();
- static const uint32_t kBlendWriteShift = 1;
- static const uint32_t kBlendCoeffShift = 5;
+ static constexpr uint32_t kBlendWriteShift = 1;
+ static constexpr uint32_t kBlendCoeffShift = 5;
static_assert(kLast_GrBlendCoeff < (1 << kBlendCoeffShift));
static_assert(kFirstAdvancedGrBlendEquation - 1 < 4);