1 /* 2 * Copyright 2019 Google Inc. 3 * 4 * Use of this source code is governed by a BSD-style license that can be 5 * found in the LICENSE file. 6 */ 7 8 #ifndef GrVSCoverageProcessor_DEFINED 9 #define GrVSCoverageProcessor_DEFINED 10 11 #include "src/gpu/ccpr/GrCCCoverageProcessor.h" 12 13 /** 14 * This class implements GrCCCoverageProcessor with analytic coverage using vertex shaders. 15 */ 16 class GrVSCoverageProcessor : public GrCCCoverageProcessor { 17 public: GrVSCoverageProcessor()18 GrVSCoverageProcessor() : GrCCCoverageProcessor(kGrVSCoverageProcessor_ClassID) {} 19 20 private: 21 void reset(PrimitiveType, GrResourceProvider*) override; 22 23 void appendMesh(sk_sp<const GrGpuBuffer> instanceBuffer, int instanceCount, int baseInstance, 24 SkTArray<GrMesh>* out) const override; 25 primType()26 GrPrimitiveType primType() const final { return fTriangleType; } 27 28 GrGLSLPrimitiveProcessor* onCreateGLSLInstance(std::unique_ptr<Shader>) const override; 29 30 Attribute fPerVertexData; 31 Attribute fInputXAndYValues[2]; 32 sk_sp<const GrGpuBuffer> fVertexBuffer; 33 sk_sp<const GrGpuBuffer> fIndexBuffer; 34 int fNumIndicesPerInstance; 35 GrPrimitiveType fTriangleType = GrPrimitiveType::kPoints; 36 37 class Impl; 38 }; 39 40 #endif 41