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; | |
14 class GrGLGPBuilder; | 13 class GrGLGPBuilder; |
15 | 14 |
16 /** | 15 /** |
17 * If a GL effect needs a GrGLFullShaderBuilder* object to emit vertex code, the
n it must inherit | 16 * If a GL effect needs a GrGLFullShaderBuilder* object to emit vertex code, the
n it must inherit |
18 * from this class. Since paths don't have vertices, this class is only meant to
be used internally | 17 * from this class. Since paths don't have vertices, this class is only meant to
be used internally |
19 * by skia, for special cases. | 18 * by skia, for special cases. |
20 */ | 19 */ |
21 class GrGLGeometryProcessor : public GrGLProcessor { | 20 class GrGLGeometryProcessor : public GrGLProcessor { |
22 public: | 21 public: |
23 GrGLGeometryProcessor(const GrBackendProcessorFactory& factory) | 22 GrGLGeometryProcessor(const GrBackendProcessorFactory& factory) |
24 : INHERITED(factory) {} | 23 : INHERITED(factory) {} |
25 | 24 |
26 struct EmitArgs { | 25 struct EmitArgs { |
27 EmitArgs(GrGLGPBuilder* pb, | 26 EmitArgs(GrGLGPBuilder* pb, |
28 const GrGeometryProcessor& gp, | 27 const GrGeometryProcessor& gp, |
29 const GrBatchTracker& bt, | |
30 const char* outputColor, | 28 const char* outputColor, |
31 const char* outputCoverage, | 29 const char* outputCoverage, |
32 const TextureSamplerArray& samplers) | 30 const TextureSamplerArray& samplers) |
33 : fPB(pb) | 31 : fPB(pb) |
34 , fGP(gp) | 32 , fGP(gp) |
35 , fBT(bt) | |
36 , fOutputColor(outputColor) | 33 , fOutputColor(outputColor) |
37 , fOutputCoverage(outputCoverage) | 34 , fOutputCoverage(outputCoverage) |
38 , fSamplers(samplers) {} | 35 , fSamplers(samplers) {} |
39 GrGLGPBuilder* fPB; | 36 GrGLGPBuilder* fPB; |
40 const GrGeometryProcessor& fGP; | 37 const GrGeometryProcessor& fGP; |
41 const GrBatchTracker& fBT; | |
42 const char* fOutputColor; | 38 const char* fOutputColor; |
43 const char* fOutputCoverage; | 39 const char* fOutputCoverage; |
44 const TextureSamplerArray& fSamplers; | 40 const TextureSamplerArray& fSamplers; |
45 }; | 41 }; |
46 /** | 42 /** |
47 * This is similar to emitCode() in the base class, except it takes a full s
hader builder. | 43 * This is similar to emitCode() in the base class, except it takes a full s
hader builder. |
48 * This allows the effect subclass to emit vertex code. | 44 * This allows the effect subclass to emit vertex code. |
49 */ | 45 */ |
50 virtual void emitCode(const EmitArgs&) = 0; | 46 virtual void emitCode(const EmitArgs&) = 0; |
51 | 47 |
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 | |
61 private: | 48 private: |
62 typedef GrGLProcessor INHERITED; | 49 typedef GrGLProcessor INHERITED; |
63 }; | 50 }; |
64 | 51 |
65 #endif | 52 #endif |
OLD | NEW |