ccpr: Pack wind into existing varyings
Bug: skia:
Change-Id: I189a22a6779af5d3fa7671992da50ede36eaaa8f
Reviewed-on: https://skia-review.googlesource.com/102067
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
diff --git a/src/gpu/ccpr/GrCCCoverageProcessor.h b/src/gpu/ccpr/GrCCCoverageProcessor.h
index eeb2ace..1296e08 100644
--- a/src/gpu/ccpr/GrCCCoverageProcessor.h
+++ b/src/gpu/ccpr/GrCCCoverageProcessor.h
@@ -59,7 +59,7 @@
enum class RenderPass {
// For a Hull, the Impl generates a "conservative raster hull" around the input points. This
// is the geometry that causes a pixel to be rasterized if it is touched anywhere by the
- // input polygon. The initial coverage values sent to the Shader at each vertex are either
+ // input polygon. The input coverage values sent to the Shader at each vertex are either
// null, or +1 all around if the Impl combines this pass with kTriangleEdges. Logically,
// the conservative raster hull is equivalent to the convex hull of pixel size boxes
// centered on each input point.
@@ -68,7 +68,7 @@
kCubicHulls,
// For Edges, the Impl generates conservative rasters around every input edge (i.e. convex
- // hulls of two pixel-size boxes centered on both of the edge's endpoints). The initial
+ // hulls of two pixel-size boxes centered on both of the edge's endpoints). The input
// coverage values sent to the Shader at each vertex are -1 on the outside border of the
// edge geometry and 0 on the inside. This is the only geometry type that associates
// coverage values with the output vertices. Interpolated, these coverage values convert
@@ -80,7 +80,7 @@
// For Corners, the Impl Generates the conservative rasters of corner points (i.e.
// pixel-size boxes). It generates 3 corner boxes for triangles and 2 for curves. The Shader
- // specifies which corners. Initial coverage values sent to the Shader will be null.
+ // specifies which corners. Input coverage values sent to the Shader will be null.
kTriangleCorners,
kQuadraticCorners,
kCubicCorners
@@ -162,8 +162,12 @@
const char* repetitionID, const char* wind,
GeometryVars*) const {}
- void emitVaryings(GrGLSLVaryingHandler*, GrGLSLVarying::Scope, SkString* code,
- const char* position, const char* coverage, const char* wind);
+ void emitVaryings(GrGLSLVaryingHandler* varyingHandler, GrGLSLVarying::Scope scope,
+ SkString* code, const char* position, const char* inputCoverage,
+ const char* wind) {
+ SkASSERT(GrGLSLVarying::Scope::kVertToGeo != scope);
+ this->onEmitVaryings(varyingHandler, scope, code, position, inputCoverage, wind);
+ }
void emitFragmentCode(const GrCCCoverageProcessor& proc, GrGLSLPPFragmentBuilder*,
const char* skOutputColor, const char* skOutputCoverage) const;
@@ -178,25 +182,16 @@
virtual ~Shader() {}
protected:
- enum class WindHandling : bool {
- kHandled,
- kNotHandled
- };
-
// Here the subclass adds its internal varyings to the handler and produces code to
- // initialize those varyings from a given position, coverage value, and wind.
+ // initialize those varyings from a given position, input coverage value, and wind.
//
- // Returns whether the subclass will handle wind modulation or if this base class should
- // take charge of multiplying the final coverage output by "wind".
- //
- // NOTE: the coverage parameter is only relevant for edges (see comments in RenderPass).
+ // NOTE: the coverage input is only relevant for edges (see comments in RenderPass).
// Otherwise it is +1 all around.
- virtual WindHandling onEmitVaryings(GrGLSLVaryingHandler*, GrGLSLVarying::Scope,
- SkString* code, const char* position,
- const char* coverage, const char* wind) = 0;
+ virtual void onEmitVaryings(GrGLSLVaryingHandler*, GrGLSLVarying::Scope, SkString* code,
+ const char* position, const char* inputCoverage,
+ const char* wind) = 0;
- // Emits the fragment code that calculates a pixel's coverage value. If using
- // WindHandling::kHandled, this value must be signed appropriately.
+ // Emits the fragment code that calculates a pixel's signed coverage value.
virtual void onEmitFragmentCode(GrGLSLPPFragmentBuilder*,
const char* outputCoverage) const = 0;
@@ -213,9 +208,6 @@
//
// Returns the number of samples.
static int DefineSoftSampleLocations(GrGLSLPPFragmentBuilder* f, const char* samplesName);
-
- private:
- GrGLSLVarying fWind;
};
class GSImpl;