OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #ifndef GrGeometryProcessor_DEFINED | 8 #ifndef GrGeometryProcessor_DEFINED |
9 #define GrGeometryProcessor_DEFINED | 9 #define GrGeometryProcessor_DEFINED |
10 | 10 |
11 #include "GrPrimitiveProcessor.h" | 11 #include "GrPrimitiveProcessor.h" |
12 | 12 |
13 /** | 13 /** |
14 * A GrGeometryProcessor is a flexible method for rendering a primitive. The Gr
GeometryProcessor | 14 * A GrGeometryProcessor is a flexible method for rendering a primitive. The Gr
GeometryProcessor |
15 * has complete control over vertex attributes and uniforms(aside from the rende
r target) but it | 15 * has complete control over vertex attributes and uniforms(aside from the rende
r target) but it |
16 * must obey the same contract as any GrPrimitiveProcessor, specifically it must
emit a color and | 16 * must obey the same contract as any GrPrimitiveProcessor, specifically it must
emit a color and |
17 * coverage into the fragment shader. Where this color and coverage come from i
s completely the | 17 * coverage into the fragment shader. Where this color and coverage come from i
s completely the |
18 * responsibility of the GrGeometryProcessor. | 18 * responsibility of the GrGeometryProcessor. |
19 */ | 19 */ |
20 class GrGeometryProcessor : public GrPrimitiveProcessor { | 20 class GrGeometryProcessor : public GrPrimitiveProcessor { |
21 public: | 21 public: |
22 GrGeometryProcessor() | 22 GrGeometryProcessor() |
23 : fWillUseGeoShader(false) | 23 : fWillUseGeoShader(false) |
24 , fLocalCoordsType(kUnused_LocalCoordsType) | 24 , fLocalCoordsType(kUnused_LocalCoordsType) |
25 , fSampleShading(0.0) {} | 25 , fSampleShading(0.0) {} |
26 | 26 |
27 bool willUseGeoShader() const override { return fWillUseGeoShader; } | 27 bool willUseGeoShader() const override { return fWillUseGeoShader; } |
28 | 28 |
29 bool hasTransformedLocalCoords() const override { | |
30 return kHasTransformed_LocalCoordsType == fLocalCoordsType; | |
31 } | |
32 | |
33 bool hasExplicitLocalCoords() const override { | 29 bool hasExplicitLocalCoords() const override { |
34 return kHasExplicit_LocalCoordsType == fLocalCoordsType; | 30 return kHasExplicit_LocalCoordsType == fLocalCoordsType; |
35 } | 31 } |
36 | 32 |
37 /** | 33 /** |
38 * Returns the minimum fraction of samples for which the fragment shader wil
l be run. For | 34 * Returns the minimum fraction of samples for which the fragment shader wil
l be run. For |
39 * instance, if sampleShading is 0.5 in MSAA16 mode, the fragment shader wil
l run a minimum of | 35 * instance, if sampleShading is 0.5 in MSAA16 mode, the fragment shader wil
l run a minimum of |
40 * 8 times per pixel. The default value is zero. | 36 * 8 times per pixel. The default value is zero. |
41 */ | 37 */ |
42 float getSampleShading() const override { | 38 float getSampleShading() const override { |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 | 87 |
92 private: | 88 private: |
93 bool fWillUseGeoShader; | 89 bool fWillUseGeoShader; |
94 LocalCoordsType fLocalCoordsType; | 90 LocalCoordsType fLocalCoordsType; |
95 float fSampleShading; | 91 float fSampleShading; |
96 | 92 |
97 typedef GrPrimitiveProcessor INHERITED; | 93 typedef GrPrimitiveProcessor INHERITED; |
98 }; | 94 }; |
99 | 95 |
100 #endif | 96 #endif |
OLD | NEW |