OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 GrGLPathRendering_DEFINED | 8 #ifndef GrGLPathRendering_DEFINED |
9 #define GrGLPathRendering_DEFINED | 9 #define GrGLPathRendering_DEFINED |
10 | 10 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 | 47 |
48 /* Called when the 3D context state is unknown. */ | 48 /* Called when the 3D context state is unknown. */ |
49 void resetContext(); | 49 void resetContext(); |
50 | 50 |
51 /** | 51 /** |
52 * Called when the GPU resources have been lost and need to be abandoned | 52 * Called when the GPU resources have been lost and need to be abandoned |
53 * (for example after a context loss). | 53 * (for example after a context loss). |
54 */ | 54 */ |
55 void abandonGpuResources(); | 55 void abandonGpuResources(); |
56 | 56 |
57 | |
58 enum TexturingMode { | |
59 FixedFunction_TexturingMode, | |
60 SeparableShaders_TexturingMode | |
61 }; | |
62 | |
63 /** Specifies whether texturing should use fixed fuction pipe or separable s
haders | |
64 * Specifies whether texturing should use fixed fuction pipe or whether | |
65 * it is ok to use normal vertex and fragment shaders, and for path renderin
g | |
66 * populate fragment shaders with setProgramPathFragmentInputTransform. | |
67 * The fixed function mode will be removed once the other mode is more widel
y | |
68 * available. | |
69 */ | |
70 TexturingMode texturingMode() const { | |
71 return caps().fragmentInputGenSupport ? | |
72 SeparableShaders_TexturingMode : FixedFunction_TexturingMode; | |
73 } | |
74 | |
75 // Functions for fixed function texturing support. | |
76 enum PathTexGenComponents { | |
77 kS_PathTexGenComponents = 1, | |
78 kST_PathTexGenComponents = 2, | |
79 kSTR_PathTexGenComponents = 3 | |
80 }; | |
81 void enablePathTexGen(int unitIdx, PathTexGenComponents, const GrGLfloat* co
efficients); | |
82 void enablePathTexGen(int unitIdx, PathTexGenComponents, const SkMatrix& mat
rix); | |
83 void flushPathTexGenSettings(int numUsedTexCoordSets); | |
84 | |
85 // Functions for "separable shader" texturing support. | 57 // Functions for "separable shader" texturing support. |
86 void setProgramPathFragmentInputTransform(GrGLuint program, GrGLint location
, | 58 void setProgramPathFragmentInputTransform(GrGLuint program, GrGLint location
, |
87 GrGLenum genMode, GrGLint componen
ts, | 59 GrGLenum genMode, GrGLint componen
ts, |
88 const SkMatrix&); | 60 const SkMatrix&); |
89 | 61 |
90 /* Sets the projection matrix for path rendering */ | 62 /* Sets the projection matrix for path rendering */ |
91 void setProjectionMatrix(const SkMatrix& matrix, | 63 void setProjectionMatrix(const SkMatrix& matrix, |
92 const SkISize& renderTargetSize, | 64 const SkISize& renderTargetSize, |
93 GrSurfaceOrigin renderTargetOrigin); | 65 GrSurfaceOrigin renderTargetOrigin); |
94 | 66 |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 GrGLGpu* fGpu; | 133 GrGLGpu* fGpu; |
162 SkAutoTDelete<GrGLNameAllocator> fPathNameAllocator; | 134 SkAutoTDelete<GrGLNameAllocator> fPathNameAllocator; |
163 Caps fCaps; | 135 Caps fCaps; |
164 MatrixState fHWProjectionMatrixState; | 136 MatrixState fHWProjectionMatrixState; |
165 GrStencilSettings fHWPathStencilSettings; | 137 GrStencilSettings fHWPathStencilSettings; |
166 struct PathTexGenData { | 138 struct PathTexGenData { |
167 GrGLenum fMode; | 139 GrGLenum fMode; |
168 GrGLint fNumComponents; | 140 GrGLint fNumComponents; |
169 GrGLfloat fCoefficients[3 * 3]; | 141 GrGLfloat fCoefficients[3 * 3]; |
170 }; | 142 }; |
171 int fHWActivePathTexGenSets; | |
172 SkTArray<PathTexGenData, true> fHWPathTexGenSettings; | |
173 }; | 143 }; |
174 | 144 |
175 #endif | 145 #endif |
OLD | NEW |