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 GrGLGeometryProcessor_DEFINED | 8 #ifndef GrGLGeometryProcessor_DEFINED |
9 #define GrGLGeometryProcessor_DEFINED | 9 #define GrGLGeometryProcessor_DEFINED |
10 | 10 |
11 #include "GrGLProcessor.h" | 11 #include "GrGLProcessor.h" |
12 | 12 |
| 13 class GrBatchTracker; |
13 class GrGLGPBuilder; | 14 class GrGLGPBuilder; |
14 | 15 |
15 /** | 16 /** |
16 * If a GL effect needs a GrGLFullShaderBuilder* object to emit vertex code, the
n it must inherit | 17 * If a GL effect needs a GrGLFullShaderBuilder* object to emit vertex code, the
n it must inherit |
17 * from this class. Since paths don't have vertices, this class is only meant to
be used internally | 18 * from this class. Since paths don't have vertices, this class is only meant to
be used internally |
18 * by skia, for special cases. | 19 * by skia, for special cases. |
19 */ | 20 */ |
20 class GrGLGeometryProcessor : public GrGLProcessor { | 21 class GrGLGeometryProcessor : public GrGLProcessor { |
21 public: | 22 public: |
22 GrGLGeometryProcessor(const GrBackendProcessorFactory& factory) | 23 GrGLGeometryProcessor(const GrBackendProcessorFactory& factory) |
23 : INHERITED(factory) {} | 24 : INHERITED(factory) {} |
24 | 25 |
25 struct EmitArgs { | 26 struct EmitArgs { |
26 EmitArgs(GrGLGPBuilder* pb, | 27 EmitArgs(GrGLGPBuilder* pb, |
27 const GrGeometryProcessor& gp, | 28 const GrGeometryProcessor& gp, |
| 29 const GrBatchTracker& bt, |
28 const char* outputColor, | 30 const char* outputColor, |
29 const char* outputCoverage, | 31 const char* outputCoverage, |
30 const TextureSamplerArray& samplers) | 32 const TextureSamplerArray& samplers) |
31 : fPB(pb) | 33 : fPB(pb) |
32 , fGP(gp) | 34 , fGP(gp) |
| 35 , fBT(bt) |
33 , fOutputColor(outputColor) | 36 , fOutputColor(outputColor) |
34 , fOutputCoverage(outputCoverage) | 37 , fOutputCoverage(outputCoverage) |
35 , fSamplers(samplers) {} | 38 , fSamplers(samplers) {} |
36 GrGLGPBuilder* fPB; | 39 GrGLGPBuilder* fPB; |
37 const GrGeometryProcessor& fGP; | 40 const GrGeometryProcessor& fGP; |
| 41 const GrBatchTracker& fBT; |
38 const char* fOutputColor; | 42 const char* fOutputColor; |
39 const char* fOutputCoverage; | 43 const char* fOutputCoverage; |
40 const TextureSamplerArray& fSamplers; | 44 const TextureSamplerArray& fSamplers; |
41 }; | 45 }; |
42 /** | 46 /** |
43 * This is similar to emitCode() in the base class, except it takes a full s
hader builder. | 47 * This is similar to emitCode() in the base class, except it takes a full s
hader builder. |
44 * This allows the effect subclass to emit vertex code. | 48 * This allows the effect subclass to emit vertex code. |
45 */ | 49 */ |
46 virtual void emitCode(const EmitArgs&) = 0; | 50 virtual void emitCode(const EmitArgs&) = 0; |
47 | 51 |
| 52 /** A GrGLGeometryProcessor instance can be reused with any GrGLGeometryProc
essor that produces |
| 53 the same stage key; this function reads data from a GrGLGeometryProcesso
r and uploads any |
| 54 uniform variables required by the shaders created in emitCode(). The Gr
GeometryProcessor |
| 55 parameter is guaranteed to be of the same type that created this GrGLGeo
metryProcessor and |
| 56 to have an identical processor key as the one that created this GrGLGeom
etryProcessor. */ |
| 57 virtual void setData(const GrGLProgramDataManager&, |
| 58 const GrGeometryProcessor&, |
| 59 const GrBatchTracker&) = 0; |
| 60 |
48 private: | 61 private: |
49 typedef GrGLProcessor INHERITED; | 62 typedef GrGLProcessor INHERITED; |
50 }; | 63 }; |
51 | 64 |
52 #endif | 65 #endif |
OLD | NEW |