blob: 6893e882dce47cc7d0d1bfc332f4bd43381d3f4a [file] [log] [blame]
joshualitt8072caa2015-02-12 14:20:52 -08001/*
2 * Copyright 2013 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 GrPathProcessor_DEFINED
9#define GrPathProcessor_DEFINED
10
11#include "GrPrimitiveProcessor.h"
12
joshualitt8072caa2015-02-12 14:20:52 -080013/*
14 * The path equivalent of the GP. For now this just manages color. In the long term we plan on
15 * extending this class to handle all nvpr uniform / varying / program work.
16 */
17class GrPathProcessor : public GrPrimitiveProcessor {
18public:
19 static GrPathProcessor* Create(GrColor color,
20 const SkMatrix& viewMatrix = SkMatrix::I(),
21 const SkMatrix& localMatrix = SkMatrix::I()) {
Brian Salomonecea86a2017-01-04 13:25:17 -050022 return new GrPathProcessor(color, viewMatrix, localMatrix);
joshualitt8072caa2015-02-12 14:20:52 -080023 }
24
mtklein36352bf2015-03-25 18:17:31 -070025 const char* name() const override { return "PathProcessor"; }
joshualitt8072caa2015-02-12 14:20:52 -080026
27 GrColor color() const { return fColor; }
joshualitte3ababe2015-05-15 07:56:07 -070028 const SkMatrix& viewMatrix() const { return fViewMatrix; }
29 const SkMatrix& localMatrix() const { return fLocalMatrix; }
30
mtklein36352bf2015-03-25 18:17:31 -070031 bool willUseGeoShader() const override { return false; }
joshualitt8072caa2015-02-12 14:20:52 -080032
Brian Salomon94efbf52016-11-29 13:43:05 -050033 virtual void getGLSLProcessorKey(const GrShaderCaps& caps,
egdaniel57d3b032015-11-13 11:57:27 -080034 GrProcessorKeyBuilder* b) const override;
joshualitt8072caa2015-02-12 14:20:52 -080035
Brian Salomon94efbf52016-11-29 13:43:05 -050036 virtual GrGLSLPrimitiveProcessor* createGLSLInstance(const GrShaderCaps& caps) const override;
joshualitt8072caa2015-02-12 14:20:52 -080037
ethannicholas22793252016-01-30 09:59:10 -080038 virtual bool isPathRendering() const override { return true; }
39
joshualitt8072caa2015-02-12 14:20:52 -080040private:
Brian Salomon92be2f72018-06-19 14:33:47 -040041 const Attribute& onVertexAttribute(int i) const final {
42 SK_ABORT("No vertex attributes");
43 static constexpr Attribute kBogus;
44 return kBogus;
45 }
46
47 const Attribute& onInstanceAttribute(int i) const final {
48 SK_ABORT("No instanced attributes");
49 static constexpr Attribute kBogus;
50 return kBogus;
51 }
52
Brian Salomonecea86a2017-01-04 13:25:17 -050053 GrPathProcessor(GrColor, const SkMatrix& viewMatrix, const SkMatrix& localMatrix);
joshualitte3ababe2015-05-15 07:56:07 -070054
joshualitt8072caa2015-02-12 14:20:52 -080055 GrColor fColor;
joshualitte3ababe2015-05-15 07:56:07 -070056 const SkMatrix fViewMatrix;
57 const SkMatrix fLocalMatrix;
joshualitt8072caa2015-02-12 14:20:52 -080058
59 typedef GrPrimitiveProcessor INHERITED;
60};
61
62#endif