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 */
16class GrVSCoverageProcessor : public GrCCCoverageProcessor {
17public:
18 GrVSCoverageProcessor() : GrCCCoverageProcessor(kGrVSCoverageProcessor_ClassID) {}
19
20private:
21 GrPrimitiveType primType() const final { return fTriangleType; }
22 int numSubpasses() const override { return 1; }
23 void reset(PrimitiveType, int subpassIdx, GrResourceProvider*) override;
24 void bindBuffers(GrOpsRenderPass*, const GrBuffer* instanceBuffer) const override;
25 void drawInstances(GrOpsRenderPass*, int instanceCount, int baseInstance) const override;
26
27 GrGLSLPrimitiveProcessor* onCreateGLSLInstance(std::unique_ptr<Shader>) const override;
28
29 Attribute fPerVertexData;
30 Attribute fInputXAndYValues[2];
31 sk_sp<const GrGpuBuffer> fVertexBuffer;
32 sk_sp<const GrGpuBuffer> fIndexBuffer;
33 int fNumIndicesPerInstance;
34 GrPrimitiveType fTriangleType = GrPrimitiveType::kPoints;
35
36 class Impl;
37};
38
39#endif
40