blob: ea2372fffa06c9da393bdca28c2126bdc84260f2 [file] [log] [blame]
Chris Dalton2c5e0112019-03-29 13:14:18 -05001/*
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
Mike Kleinc0bd9f92019-04-23 12:05:21 -050011#include "src/gpu/ccpr/GrCCCoverageProcessor.h"
Chris Dalton2c5e0112019-03-29 13:14:18 -050012
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 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
Robert Phillipscea290f2019-11-06 11:21:03 -050026 GrPrimitiveType primType() const final { return fTriangleType; }
27
Chris Dalton2c5e0112019-03-29 13:14:18 -050028 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;
Robert Phillipscea290f2019-11-06 11:21:03 -050035 GrPrimitiveType fTriangleType = GrPrimitiveType::kPoints;
Chris Dalton2c5e0112019-03-29 13:14:18 -050036
37 class Impl;
38};
39
40#endif