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 GrGLSLCaps; | 18 class GrGLSLCaps; |
19 class GrGLSLFragmentBuilder; | 19 class GrGLSLPPFragmentBuilder; |
20 class GrGLSLGPBuilder; | 20 class GrGLSLGPBuilder; |
21 class GrGLSLUniformHandler; | 21 class GrGLSLUniformHandler; |
22 class GrGLSLVaryingHandler; | 22 class GrGLSLVaryingHandler; |
23 class GrGLSLVertexBuilder; | 23 class GrGLSLVertexBuilder; |
24 | 24 |
25 class GrGLSLPrimitiveProcessor { | 25 class GrGLSLPrimitiveProcessor { |
26 public: | 26 public: |
27 virtual ~GrGLSLPrimitiveProcessor() {} | 27 virtual ~GrGLSLPrimitiveProcessor() {} |
28 | 28 |
29 typedef GrGLSLProgramDataManager::UniformHandle UniformHandle; | 29 typedef GrGLSLProgramDataManager::UniformHandle UniformHandle; |
30 typedef GrGLSLTextureSampler::TextureSamplerArray TextureSamplerArray; | 30 typedef GrGLSLTextureSampler::TextureSamplerArray TextureSamplerArray; |
31 | 31 |
32 typedef SkSTArray<2, const GrCoordTransform*, true> ProcCoords; | 32 typedef SkSTArray<2, const GrCoordTransform*, true> ProcCoords; |
33 typedef SkSTArray<8, ProcCoords> TransformsIn; | 33 typedef SkSTArray<8, ProcCoords> TransformsIn; |
34 typedef SkSTArray<8, GrGLSLTransformedCoordsArray> TransformsOut; | 34 typedef SkSTArray<8, GrGLSLTransformedCoordsArray> TransformsOut; |
35 | 35 |
36 struct EmitArgs { | 36 struct EmitArgs { |
37 EmitArgs(GrGLSLVertexBuilder* vertBuilder, | 37 EmitArgs(GrGLSLVertexBuilder* vertBuilder, |
38 GrGLSLFragmentBuilder* fragBuilder, | 38 GrGLSLPPFragmentBuilder* fragBuilder, |
39 GrGLSLVaryingHandler* varyingHandler, | 39 GrGLSLVaryingHandler* varyingHandler, |
40 GrGLSLUniformHandler* uniformHandler, | 40 GrGLSLUniformHandler* uniformHandler, |
41 const GrGLSLCaps* caps, | 41 const GrGLSLCaps* caps, |
42 const GrPrimitiveProcessor& gp, | 42 const GrPrimitiveProcessor& gp, |
43 const char* outputColor, | 43 const char* outputColor, |
44 const char* outputCoverage, | 44 const char* outputCoverage, |
45 const TextureSamplerArray& samplers, | 45 const TextureSamplerArray& samplers, |
46 const TransformsIn& transformsIn, | 46 const TransformsIn& transformsIn, |
47 TransformsOut* transformsOut) | 47 TransformsOut* transformsOut) |
48 : fVertBuilder(vertBuilder) | 48 : fVertBuilder(vertBuilder) |
49 , fFragBuilder(fragBuilder) | 49 , fFragBuilder(fragBuilder) |
50 , fVaryingHandler(varyingHandler) | 50 , fVaryingHandler(varyingHandler) |
51 , fUniformHandler(uniformHandler) | 51 , fUniformHandler(uniformHandler) |
52 , fGLSLCaps(caps) | 52 , fGLSLCaps(caps) |
53 , fGP(gp) | 53 , fGP(gp) |
54 , fOutputColor(outputColor) | 54 , fOutputColor(outputColor) |
55 , fOutputCoverage(outputCoverage) | 55 , fOutputCoverage(outputCoverage) |
56 , fSamplers(samplers) | 56 , fSamplers(samplers) |
57 , fTransformsIn(transformsIn) | 57 , fTransformsIn(transformsIn) |
58 , fTransformsOut(transformsOut) {} | 58 , fTransformsOut(transformsOut) {} |
59 GrGLSLVertexBuilder* fVertBuilder; | 59 GrGLSLVertexBuilder* fVertBuilder; |
60 GrGLSLFragmentBuilder* fFragBuilder; | 60 GrGLSLPPFragmentBuilder* fFragBuilder; |
61 GrGLSLVaryingHandler* fVaryingHandler; | 61 GrGLSLVaryingHandler* fVaryingHandler; |
62 GrGLSLUniformHandler* fUniformHandler; | 62 GrGLSLUniformHandler* fUniformHandler; |
63 const GrGLSLCaps* fGLSLCaps; | 63 const GrGLSLCaps* fGLSLCaps; |
64 const GrPrimitiveProcessor& fGP; | 64 const GrPrimitiveProcessor& fGP; |
65 const char* fOutputColor; | 65 const char* fOutputColor; |
66 const char* fOutputCoverage; | 66 const char* fOutputCoverage; |
67 const TextureSamplerArray& fSamplers; | 67 const TextureSamplerArray& fSamplers; |
68 const TransformsIn& fTransformsIn; | 68 const TransformsIn& fTransformsIn; |
69 TransformsOut* fTransformsOut; | 69 TransformsOut* fTransformsOut; |
70 }; | 70 }; |
(...skipping 14 matching lines...) Expand all Loading... |
85 virtual void setData(const GrGLSLProgramDataManager&, const GrPrimitiveProce
ssor&) = 0; | 85 virtual void setData(const GrGLSLProgramDataManager&, const GrPrimitiveProce
ssor&) = 0; |
86 | 86 |
87 static SkMatrix GetTransformMatrix(const SkMatrix& localMatrix, const GrCoor
dTransform&); | 87 static SkMatrix GetTransformMatrix(const SkMatrix& localMatrix, const GrCoor
dTransform&); |
88 | 88 |
89 virtual void setTransformData(const GrPrimitiveProcessor&, | 89 virtual void setTransformData(const GrPrimitiveProcessor&, |
90 const GrGLSLProgramDataManager& pdman, | 90 const GrGLSLProgramDataManager& pdman, |
91 int index, | 91 int index, |
92 const SkTArray<const GrCoordTransform*, true>&
transforms) = 0; | 92 const SkTArray<const GrCoordTransform*, true>&
transforms) = 0; |
93 | 93 |
94 protected: | 94 protected: |
95 void setupUniformColor(GrGLSLFragmentBuilder* fragBuilder, | 95 void setupUniformColor(GrGLSLPPFragmentBuilder* fragBuilder, |
96 GrGLSLUniformHandler* uniformHandler, | 96 GrGLSLUniformHandler* uniformHandler, |
97 const char* outputName, | 97 const char* outputName, |
98 UniformHandle* colorUniform); | 98 UniformHandle* colorUniform); |
99 | 99 |
100 struct Transform { | 100 struct Transform { |
101 Transform() : fType(kVoid_GrSLType) { fCurrentValue = SkMatrix::InvalidM
atrix(); } | 101 Transform() : fType(kVoid_GrSLType) { fCurrentValue = SkMatrix::InvalidM
atrix(); } |
102 UniformHandle fHandle; | 102 UniformHandle fHandle; |
103 SkMatrix fCurrentValue; | 103 SkMatrix fCurrentValue; |
104 GrSLType fType; | 104 GrSLType fType; |
105 }; | 105 }; |
106 | 106 |
107 SkSTArray<8, SkSTArray<2, Transform, true> > fInstalledTransforms; | 107 SkSTArray<8, SkSTArray<2, Transform, true> > fInstalledTransforms; |
108 }; | 108 }; |
109 | 109 |
110 #endif | 110 #endif |
OLD | NEW |