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 GrGLPrimitiveProcessor_DEFINED | 8 #ifndef GrGLPrimitiveProcessor_DEFINED |
9 #define GrGLPrimitiveProcessor_DEFINED | 9 #define GrGLPrimitiveProcessor_DEFINED |
10 | 10 |
11 #include "GrPrimitiveProcessor.h" | 11 #include "GrPrimitiveProcessor.h" |
12 #include "GrGLProcessor.h" | 12 #include "GrGLProcessor.h" |
13 #include "GrGLPathProgramDataManager.h" | |
14 | 13 |
15 class GrBatchTracker; | 14 class GrBatchTracker; |
16 class GrPrimitiveProcessor; | 15 class GrPrimitiveProcessor; |
17 class GrGLGPBuilder; | 16 class GrGLGPBuilder; |
18 | 17 |
19 class GrGLPrimitiveProcessor { | 18 class GrGLPrimitiveProcessor { |
20 public: | 19 public: |
21 virtual ~GrGLPrimitiveProcessor() {} | 20 virtual ~GrGLPrimitiveProcessor() {} |
22 | 21 |
23 typedef GrGLProgramDataManager::UniformHandle UniformHandle; | 22 typedef GrGLProgramDataManager::UniformHandle UniformHandle; |
24 typedef GrGLPathProgramDataManager::SeparableVaryingHandle SeparableVaryingH
andle; | |
25 typedef GrGLProcessor::TextureSamplerArray TextureSamplerArray; | 23 typedef GrGLProcessor::TextureSamplerArray TextureSamplerArray; |
26 | 24 |
27 typedef SkSTArray<2, const GrCoordTransform*, true> ProcCoords; | 25 typedef SkSTArray<2, const GrCoordTransform*, true> ProcCoords; |
28 typedef SkSTArray<8, ProcCoords> TransformsIn; | 26 typedef SkSTArray<8, ProcCoords> TransformsIn; |
29 typedef SkSTArray<8, GrGLProcessor::TransformedCoordsArray> TransformsOut; | 27 typedef SkSTArray<8, GrGLProcessor::TransformedCoordsArray> TransformsOut; |
30 | 28 |
31 struct EmitArgs { | 29 struct EmitArgs { |
32 EmitArgs(GrGLGPBuilder* pb, | 30 EmitArgs(GrGLGPBuilder* pb, |
33 const GrPrimitiveProcessor& gp, | 31 const GrPrimitiveProcessor& gp, |
34 const char* outputColor, | 32 const char* outputColor, |
(...skipping 27 matching lines...) Expand all Loading... |
62 /** A GrGLPrimitiveProcessor instance can be reused with any GrGLPrimitivePr
ocessor that | 60 /** A GrGLPrimitiveProcessor instance can be reused with any GrGLPrimitivePr
ocessor that |
63 produces the same stage key; this function reads data from a GrGLPrimiti
veProcessor and | 61 produces the same stage key; this function reads data from a GrGLPrimiti
veProcessor and |
64 uploads any uniform variables required by the shaders created in emitCo
de(). The | 62 uploads any uniform variables required by the shaders created in emitCo
de(). The |
65 GrPrimitiveProcessor parameter is guaranteed to be of the same type that
created this | 63 GrPrimitiveProcessor parameter is guaranteed to be of the same type that
created this |
66 GrGLPrimitiveProcessor and to have an identical processor key as the one
that created this | 64 GrGLPrimitiveProcessor and to have an identical processor key as the one
that created this |
67 GrGLPrimitiveProcessor. */ | 65 GrGLPrimitiveProcessor. */ |
68 virtual void setData(const GrGLProgramDataManager&, const GrPrimitiveProcess
or&) = 0; | 66 virtual void setData(const GrGLProgramDataManager&, const GrPrimitiveProcess
or&) = 0; |
69 | 67 |
70 static SkMatrix GetTransformMatrix(const SkMatrix& localMatrix, const GrCoor
dTransform&); | 68 static SkMatrix GetTransformMatrix(const SkMatrix& localMatrix, const GrCoor
dTransform&); |
71 | 69 |
| 70 virtual void setTransformData(const GrPrimitiveProcessor&, |
| 71 const GrGLProgramDataManager& pdman, |
| 72 int index, |
| 73 const SkTArray<const GrCoordTransform*, true>&
transforms) = 0; |
| 74 |
72 protected: | 75 protected: |
73 void setupUniformColor(GrGLGPBuilder* pb, const char* outputName, UniformHan
dle* colorUniform); | 76 void setupUniformColor(GrGLGPBuilder* pb, const char* outputName, UniformHan
dle* colorUniform); |
74 | 77 |
75 struct Transform { | 78 struct Transform { |
76 Transform() : fType(kVoid_GrSLType) { fCurrentValue = SkMatrix::InvalidM
atrix(); } | 79 Transform() : fType(kVoid_GrSLType) { fCurrentValue = SkMatrix::InvalidM
atrix(); } |
77 GrGLProgramDataManager::UniformHandle fHandle; | 80 GrGLProgramDataManager::UniformHandle fHandle; |
78 SkMatrix fCurrentValue; | 81 SkMatrix fCurrentValue; |
79 GrSLType fType; | 82 GrSLType fType; |
80 }; | 83 }; |
81 | 84 |
82 SkSTArray<8, SkSTArray<2, Transform, true> > fInstalledTransforms; | 85 SkSTArray<8, SkSTArray<2, Transform, true> > fInstalledTransforms; |
83 }; | 86 }; |
84 | 87 |
85 #endif | 88 #endif |
OLD | NEW |