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 GrGLSLPrimitiveProcessor_DEFINED | 8 #ifndef GrGLSLPrimitiveProcessor_DEFINED |
9 #define GrGLSLPrimitiveProcessor_DEFINED | 9 #define GrGLSLPrimitiveProcessor_DEFINED |
10 | 10 |
11 #include "GrPrimitiveProcessor.h" | 11 #include "GrPrimitiveProcessor.h" |
12 #include "glsl/GrGLSLProcessorTypes.h" | 12 #include "glsl/GrGLSLProcessorTypes.h" |
13 #include "glsl/GrGLSLProgramDataManager.h" | 13 #include "glsl/GrGLSLProgramDataManager.h" |
14 #include "glsl/GrGLSLTextureSampler.h" | 14 #include "glsl/GrGLSLTextureSampler.h" |
15 | 15 |
16 class GrBatchTracker; | 16 class GrBatchTracker; |
17 class GrPrimitiveProcessor; | 17 class GrPrimitiveProcessor; |
| 18 class GrGLSLVertexBuilder; |
| 19 class GrGLSLFragmentBuilder; |
18 class GrGLSLGPBuilder; | 20 class GrGLSLGPBuilder; |
19 | 21 |
20 class GrGLSLPrimitiveProcessor { | 22 class GrGLSLPrimitiveProcessor { |
21 public: | 23 public: |
22 virtual ~GrGLSLPrimitiveProcessor() {} | 24 virtual ~GrGLSLPrimitiveProcessor() {} |
23 | 25 |
24 typedef GrGLSLProgramDataManager::UniformHandle UniformHandle; | 26 typedef GrGLSLProgramDataManager::UniformHandle UniformHandle; |
25 typedef GrGLSLTextureSampler::TextureSamplerArray TextureSamplerArray; | 27 typedef GrGLSLTextureSampler::TextureSamplerArray TextureSamplerArray; |
26 | 28 |
27 typedef SkSTArray<2, const GrCoordTransform*, true> ProcCoords; | 29 typedef SkSTArray<2, const GrCoordTransform*, true> ProcCoords; |
28 typedef SkSTArray<8, ProcCoords> TransformsIn; | 30 typedef SkSTArray<8, ProcCoords> TransformsIn; |
29 typedef SkSTArray<8, GrGLSLTransformedCoordsArray> TransformsOut; | 31 typedef SkSTArray<8, GrGLSLTransformedCoordsArray> TransformsOut; |
30 | 32 |
31 struct EmitArgs { | 33 struct EmitArgs { |
32 EmitArgs(GrGLSLGPBuilder* pb, | 34 EmitArgs(GrGLSLGPBuilder* pb, |
| 35 GrGLSLVertexBuilder* vertBuilder, |
| 36 GrGLSLFragmentBuilder* fragBuilder, |
33 const GrPrimitiveProcessor& gp, | 37 const GrPrimitiveProcessor& gp, |
34 const char* outputColor, | 38 const char* outputColor, |
35 const char* outputCoverage, | 39 const char* outputCoverage, |
36 const TextureSamplerArray& samplers, | 40 const TextureSamplerArray& samplers, |
37 const TransformsIn& transformsIn, | 41 const TransformsIn& transformsIn, |
38 TransformsOut* transformsOut) | 42 TransformsOut* transformsOut) |
39 : fPB(pb) | 43 : fPB(pb) |
| 44 , fVertBuilder(vertBuilder) |
| 45 , fFragBuilder(fragBuilder) |
40 , fGP(gp) | 46 , fGP(gp) |
41 , fOutputColor(outputColor) | 47 , fOutputColor(outputColor) |
42 , fOutputCoverage(outputCoverage) | 48 , fOutputCoverage(outputCoverage) |
43 , fSamplers(samplers) | 49 , fSamplers(samplers) |
44 , fTransformsIn(transformsIn) | 50 , fTransformsIn(transformsIn) |
45 , fTransformsOut(transformsOut) {} | 51 , fTransformsOut(transformsOut) {} |
46 GrGLSLGPBuilder* fPB; | 52 GrGLSLGPBuilder* fPB; |
| 53 GrGLSLVertexBuilder* fVertBuilder; |
| 54 GrGLSLFragmentBuilder* fFragBuilder; |
47 const GrPrimitiveProcessor& fGP; | 55 const GrPrimitiveProcessor& fGP; |
48 const char* fOutputColor; | 56 const char* fOutputColor; |
49 const char* fOutputCoverage; | 57 const char* fOutputCoverage; |
50 const TextureSamplerArray& fSamplers; | 58 const TextureSamplerArray& fSamplers; |
51 const TransformsIn& fTransformsIn; | 59 const TransformsIn& fTransformsIn; |
52 TransformsOut* fTransformsOut; | 60 TransformsOut* fTransformsOut; |
53 }; | 61 }; |
54 | 62 |
55 /** | 63 /** |
56 * This is similar to emitCode() in the base class, except it takes a full s
hader builder. | 64 * This is similar to emitCode() in the base class, except it takes a full s
hader builder. |
(...skipping 12 matching lines...) Expand all Loading... |
69 | 77 |
70 static SkMatrix GetTransformMatrix(const SkMatrix& localMatrix, const GrCoor
dTransform&); | 78 static SkMatrix GetTransformMatrix(const SkMatrix& localMatrix, const GrCoor
dTransform&); |
71 | 79 |
72 virtual void setTransformData(const GrPrimitiveProcessor&, | 80 virtual void setTransformData(const GrPrimitiveProcessor&, |
73 const GrGLSLProgramDataManager& pdman, | 81 const GrGLSLProgramDataManager& pdman, |
74 int index, | 82 int index, |
75 const SkTArray<const GrCoordTransform*, true>&
transforms) = 0; | 83 const SkTArray<const GrCoordTransform*, true>&
transforms) = 0; |
76 | 84 |
77 protected: | 85 protected: |
78 void setupUniformColor(GrGLSLGPBuilder* pb, | 86 void setupUniformColor(GrGLSLGPBuilder* pb, |
| 87 GrGLSLFragmentBuilder* fragBuilder, |
79 const char* outputName, | 88 const char* outputName, |
80 UniformHandle* colorUniform); | 89 UniformHandle* colorUniform); |
81 | 90 |
82 struct Transform { | 91 struct Transform { |
83 Transform() : fType(kVoid_GrSLType) { fCurrentValue = SkMatrix::InvalidM
atrix(); } | 92 Transform() : fType(kVoid_GrSLType) { fCurrentValue = SkMatrix::InvalidM
atrix(); } |
84 UniformHandle fHandle; | 93 UniformHandle fHandle; |
85 SkMatrix fCurrentValue; | 94 SkMatrix fCurrentValue; |
86 GrSLType fType; | 95 GrSLType fType; |
87 }; | 96 }; |
88 | 97 |
89 SkSTArray<8, SkSTArray<2, Transform, true> > fInstalledTransforms; | 98 SkSTArray<8, SkSTArray<2, Transform, true> > fInstalledTransforms; |
90 }; | 99 }; |
91 | 100 |
92 #endif | 101 #endif |
OLD | NEW |