Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(66)

Side by Side Diff: src/gpu/gl/GrGLPathRendering.cpp

Issue 452823002: Separate GL path rendering state from GrGpuGL to GrGLPathRendering (Closed) Base URL: https://skia.googlesource.com/skia.git@00xx-cherrypick-pathrendering-class
Patch Set: beautify Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #include "gl/GrGLPathRendering.h" 8 #include "gl/GrGLPathRendering.h"
9 #include "gl/GrGLInterface.h" 9 #include "gl/GrGLInterface.h"
10 #include "gl/GrGLNameAllocator.h" 10 #include "gl/GrGLNameAllocator.h"
11 #include "gl/GrGLUtil.h" 11 #include "gl/GrGLUtil.h"
12 #include "gl/GrGpuGL.h"
13
14 #include "GrGLPath.h"
15 #include "GrGLPathRange.h"
16 #include "GrGLPathRendering.h"
12 17
13 #define GL_CALL(X) GR_GL_CALL(fGLInterface.get(), X) 18 #define GL_CALL(X) GR_GL_CALL(fGLInterface.get(), X)
14 #define GL_CALL_RET(RET, X) GR_GL_CALL_RET(fGLInterface.get(), RET, X) 19 #define GL_CALL_RET(RET, X) GR_GL_CALL_RET(fGLInterface.get(), RET, X)
15 20
21
22 static const GrGLenum gXformType2GLType[] = {
23 GR_GL_NONE,
24 GR_GL_TRANSLATE_X,
25 GR_GL_TRANSLATE_Y,
26 GR_GL_TRANSLATE_2D,
27 GR_GL_TRANSPOSE_AFFINE_2D
28 };
29
30 GR_STATIC_ASSERT(0 == GrPathRendering::kNone_PathTransformType);
31 GR_STATIC_ASSERT(1 == GrPathRendering::kTranslateX_PathTransformType);
32 GR_STATIC_ASSERT(2 == GrPathRendering::kTranslateY_PathTransformType);
33 GR_STATIC_ASSERT(3 == GrPathRendering::kTranslate_PathTransformType);
34 GR_STATIC_ASSERT(4 == GrPathRendering::kAffine_PathTransformType);
35 GR_STATIC_ASSERT(GrPathRendering::kAffine_PathTransformType == GrPathRendering:: kLast_PathTransformType);
36
37 static GrGLenum gr_stencil_op_to_gl_path_rendering_fill_mode(GrStencilOp op) {
38 switch (op) {
39 default:
40 SkFAIL("Unexpected path fill.");
41 /* fallthrough */;
42 case kIncClamp_StencilOp:
43 return GR_GL_COUNT_UP;
44 case kInvert_StencilOp:
45 return GR_GL_INVERT;
46 }
47 }
48
16 class GrGLPathRenderingV12 : public GrGLPathRendering { 49 class GrGLPathRenderingV12 : public GrGLPathRendering {
17 public: 50 public:
18 GrGLPathRenderingV12(const GrGLInterface* glInterface) 51 GrGLPathRenderingV12(GrGpuGL* gpu, const GrGLInterface* glInterface)
19 : GrGLPathRendering(glInterface) { 52 : GrGLPathRendering(gpu, glInterface) {
20 } 53 }
21 54
22 virtual GrGLvoid stencilThenCoverFillPath(GrGLuint path, GrGLenum fillMode, 55 virtual GrGLvoid stencilThenCoverFillPath(GrGLuint path, GrGLenum fillMode,
23 GrGLuint mask, GrGLenum coverMode) SK_OVERRIDE; 56 GrGLuint mask, GrGLenum coverMode) SK_OVERRIDE;
24 virtual GrGLvoid stencilThenCoverStrokePath(GrGLuint path, GrGLint reference , 57 virtual GrGLvoid stencilThenCoverStrokePath(GrGLuint path, GrGLint reference ,
25 GrGLuint mask, GrGLenum coverMod e) SK_OVERRIDE; 58 GrGLuint mask, GrGLenum coverMod e) SK_OVERRIDE;
26 virtual GrGLvoid stencilThenCoverFillPathInstanced( 59 virtual GrGLvoid stencilThenCoverFillPathInstanced(
27 GrGLsizei numPaths, GrGLenum pathNameType, const GrGLvo id *paths, 60 GrGLsizei numPaths, GrGLenum pathNameType, const GrGLvo id *paths,
28 GrGLuint pathBase, GrGLenum fillMode, GrGLuint mask, Gr GLenum coverMode, 61 GrGLuint pathBase, GrGLenum fillMode, GrGLuint mask, Gr GLenum coverMode,
29 GrGLenum transformType, const GrGLfloat *transformValue s) SK_OVERRIDE; 62 GrGLenum transformType, const GrGLfloat *transformValue s) SK_OVERRIDE;
30 virtual GrGLvoid stencilThenCoverStrokePathInstanced( 63 virtual GrGLvoid stencilThenCoverStrokePathInstanced(
31 GrGLsizei numPaths, GrGLenum pathNameType, const GrGLvo id *paths, 64 GrGLsizei numPaths, GrGLenum pathNameType, const GrGLvo id *paths,
32 GrGLuint pathBase, GrGLint reference, GrGLuint mask, Gr GLenum coverMode, 65 GrGLuint pathBase, GrGLint reference, GrGLuint mask, Gr GLenum coverMode,
33 GrGLenum transformType, const GrGLfloat *transformValue s) SK_OVERRIDE; 66 GrGLenum transformType, const GrGLfloat *transformValue s) SK_OVERRIDE;
34 }; 67 };
35 68
36 class GrGLPathRenderingV13 : public GrGLPathRenderingV12 { 69 class GrGLPathRenderingV13 : public GrGLPathRenderingV12 {
37 public: 70 public:
38 GrGLPathRenderingV13(const GrGLInterface* glInterface) 71 GrGLPathRenderingV13(GrGpuGL* gpu, const GrGLInterface* glInterface)
39 : GrGLPathRenderingV12(glInterface) { 72 : GrGLPathRenderingV12(gpu, glInterface) {
40 fCaps.fragmentInputGenSupport = true; 73 fCaps.fragmentInputGenSupport = true;
41 } 74 }
42 75
43 virtual GrGLvoid programPathFragmentInputGen(GrGLuint program, GrGLint locat ion, 76 virtual GrGLvoid programPathFragmentInputGen(GrGLuint program, GrGLint locat ion,
44 GrGLenum genMode, GrGLint compo nents, 77 GrGLenum genMode, GrGLint compo nents,
45 const GrGLfloat *coeffs) SK_OVE RRIDE; 78 const GrGLfloat *coeffs) SK_OVE RRIDE;
46 }; 79 };
47 80
48 81
49 GrGLPathRendering* GrGLPathRendering::Create(const GrGLInterface* glInterface) { 82 GrGLPathRendering* GrGLPathRendering::Create(GrGpuGL* gpu, const GrGLInterface* glInterface) {
50 if (NULL == glInterface->fFunctions.fStencilThenCoverFillPath || 83 if (NULL == glInterface->fFunctions.fStencilThenCoverFillPath ||
51 NULL == glInterface->fFunctions.fStencilThenCoverStrokePath || 84 NULL == glInterface->fFunctions.fStencilThenCoverStrokePath ||
52 NULL == glInterface->fFunctions.fStencilThenCoverFillPathInstanced || 85 NULL == glInterface->fFunctions.fStencilThenCoverFillPathInstanced ||
53 NULL == glInterface->fFunctions.fStencilThenCoverStrokePathInstanced) { 86 NULL == glInterface->fFunctions.fStencilThenCoverStrokePathInstanced) {
54 return new GrGLPathRendering(glInterface); 87 return new GrGLPathRendering(gpu, glInterface);
55 } 88 }
56 89
57 if (NULL == glInterface->fFunctions.fProgramPathFragmentInputGen) { 90 if (NULL == glInterface->fFunctions.fProgramPathFragmentInputGen) {
58 return new GrGLPathRenderingV12(glInterface); 91 return new GrGLPathRenderingV12(gpu, glInterface);
59 } 92 }
60 93
61 return new GrGLPathRenderingV13(glInterface); 94 return new GrGLPathRenderingV13(gpu, glInterface);
62 } 95 }
63 96
64 GrGLPathRendering::GrGLPathRendering(const GrGLInterface* glInterface) 97 GrGLPathRendering::GrGLPathRendering(GrGpuGL* gpu, const GrGLInterface* glInterf ace)
65 : fGLInterface(SkRef(glInterface)) { 98 : fGpu(gpu),
99 fGLInterface(SkRef(glInterface)) {
66 memset(&fCaps, 0, sizeof(fCaps)); 100 memset(&fCaps, 0, sizeof(fCaps));
101 fHWPathTexGenSettings.reset(fGpu->glCaps().maxFixedFunctionTextureCoords());
67 } 102 }
68 103
69 GrGLPathRendering::~GrGLPathRendering() { 104 GrGLPathRendering::~GrGLPathRendering() {
70 } 105 }
71 106
72 void GrGLPathRendering::abandonGpuResources() { 107 void GrGLPathRendering::abandonGpuResources() {
73 fPathNameAllocator.reset(NULL); 108 fPathNameAllocator.reset(NULL);
74 } 109 }
75 110
111 void GrGLPathRendering::onResetContext() {
112 fHWProjectionMatrixState.invalidate();
113 // we don't use the model view matrix.
114 GL_CALL(MatrixLoadIdentity(GR_GL_MODELVIEW));
115
116 for (int i = 0; i < fGpu->glCaps().maxFixedFunctionTextureCoords(); ++i) {
117 this->pathTexGen(GR_GL_TEXTURE0 + i, GR_GL_NONE, 0, NULL);
118 fHWPathTexGenSettings[i].fMode = GR_GL_NONE;
119 fHWPathTexGenSettings[i].fNumComponents = 0;
120 }
121 fHWActivePathTexGenSets = 0;
122 fHWPathStencilSettings.invalidate();
123 }
124
125 GrPath* GrGLPathRendering::createPath(const SkPath& inPath, const SkStrokeRec& s troke) {
126 return SkNEW_ARGS(GrGLPath, (fGpu, inPath, stroke));
127 }
128
129 GrPathRange* GrGLPathRendering::createPathRange(size_t size, const SkStrokeRec& stroke) {
130 return SkNEW_ARGS(GrGLPathRange, (fGpu, size, stroke));
131 }
132
133 void GrGLPathRendering::enablePathTexGen(int unitIdx, PathTexGenComponents compo nents,
134 const GrGLfloat* coefficients) {
135 SkASSERT(components >= kS_PathTexGenComponents &&
136 components <= kSTR_PathTexGenComponents);
137 SkASSERT(fGpu->glCaps().maxFixedFunctionTextureCoords() >= unitIdx);
138
139 if (GR_GL_OBJECT_LINEAR == fHWPathTexGenSettings[unitIdx].fMode &&
140 components == fHWPathTexGenSettings[unitIdx].fNumComponents &&
141 !memcmp(coefficients, fHWPathTexGenSettings[unitIdx].fCoefficients,
142 3 * components * sizeof(GrGLfloat))) {
143 return;
144 }
145
146 fGpu->setTextureUnit(unitIdx);
147
148 fHWPathTexGenSettings[unitIdx].fNumComponents = components;
149 this->pathTexGen(GR_GL_TEXTURE0 + unitIdx, GR_GL_OBJECT_LINEAR, components, coefficients);
150
151 memcpy(fHWPathTexGenSettings[unitIdx].fCoefficients, coefficients,
152 3 * components * sizeof(GrGLfloat));
153 }
154
155 void GrGLPathRendering::enablePathTexGen(int unitIdx, PathTexGenComponents compo nents,
156 const SkMatrix& matrix) {
157 GrGLfloat coefficients[3 * 3];
158 SkASSERT(components >= kS_PathTexGenComponents &&
159 components <= kSTR_PathTexGenComponents);
160
161 coefficients[0] = SkScalarToFloat(matrix[SkMatrix::kMScaleX]);
162 coefficients[1] = SkScalarToFloat(matrix[SkMatrix::kMSkewX]);
163 coefficients[2] = SkScalarToFloat(matrix[SkMatrix::kMTransX]);
164
165 if (components >= kST_PathTexGenComponents) {
166 coefficients[3] = SkScalarToFloat(matrix[SkMatrix::kMSkewY]);
167 coefficients[4] = SkScalarToFloat(matrix[SkMatrix::kMScaleY]);
168 coefficients[5] = SkScalarToFloat(matrix[SkMatrix::kMTransY]);
169 }
170
171 if (components >= kSTR_PathTexGenComponents) {
172 coefficients[6] = SkScalarToFloat(matrix[SkMatrix::kMPersp0]);
173 coefficients[7] = SkScalarToFloat(matrix[SkMatrix::kMPersp1]);
174 coefficients[8] = SkScalarToFloat(matrix[SkMatrix::kMPersp2]);
175 }
176
177 this->enablePathTexGen(unitIdx, components, coefficients);
178 }
179
180 void GrGLPathRendering::flushPathTexGenSettings(int numUsedTexCoordSets) {
181 SkASSERT(fGpu->glCaps().maxFixedFunctionTextureCoords() >= numUsedTexCoordSe ts);
182
183 // Only write the inactive path tex gens, since active path tex gens were
184 // written when they were enabled.
185
186 SkDEBUGCODE(
187 for (int i = 0; i < numUsedTexCoordSets; i++) {
188 SkASSERT(0 != fHWPathTexGenSettings[i].fNumComponents);
189 }
190 );
191
192 for (int i = numUsedTexCoordSets; i < fHWActivePathTexGenSets; i++) {
193 SkASSERT(0 != fHWPathTexGenSettings[i].fNumComponents);
194
195 fGpu->setTextureUnit(i);
196 GL_CALL(PathTexGen(GR_GL_TEXTURE0 + i, GR_GL_NONE, 0, NULL));
197 fHWPathTexGenSettings[i].fNumComponents = 0;
198 }
199
200 fHWActivePathTexGenSets = numUsedTexCoordSets;
201 }
202
203 void GrGLPathRendering::stencilPath(const GrPath* path, SkPath::FillType fill) {
204 GrGLuint id = static_cast<const GrGLPath*>(path)->pathID();
205 SkASSERT(NULL != fGpu->drawState()->getRenderTarget());
206 SkASSERT(NULL != fGpu->drawState()->getRenderTarget()->getStencilBuffer());
207
208 this->flushPathStencilSettings(fill);
209
210 GrGLenum fillMode =
211 gr_stencil_op_to_gl_path_rendering_fill_mode(fHWPathStencilSettings.pass Op(GrStencilSettings::kFront_Face));
212 GrGLint writeMask = fHWPathStencilSettings.writeMask(GrStencilSettings::kFro nt_Face);
213 this->stencilFillPath(id, fillMode, writeMask);
214 }
215
216 void GrGLPathRendering::drawPath(const GrPath* path, SkPath::FillType fill) {
217 GrGLuint id = static_cast<const GrGLPath*>(path)->pathID();
218 SkASSERT(NULL != fGpu->drawState()->getRenderTarget());
219 SkASSERT(NULL != fGpu->drawState()->getRenderTarget()->getStencilBuffer());
220 SkASSERT(!fGpu->fCurrentProgram->hasVertexShader());
221
222 this->flushPathStencilSettings(fill);
223 const SkStrokeRec& stroke = path->getStroke();
224
225 SkPath::FillType nonInvertedFill = SkPath::ConvertToNonInverseFillType(fill) ;
226 SkASSERT(!fHWPathStencilSettings.isTwoSided());
227 GrGLenum fillMode =
228 gr_stencil_op_to_gl_path_rendering_fill_mode(fHWPathStencilSettings.pass Op(GrStencilSettings::kFront_Face));
229 GrGLint writeMask = fHWPathStencilSettings.writeMask(GrStencilSettings::kFro nt_Face);
230
231 if (nonInvertedFill == fill) {
232 if (stroke.needToApply()) {
233 if (SkStrokeRec::kStrokeAndFill_Style == stroke.getStyle()) {
234 this->stencilFillPath(id, fillMode, writeMask);
235 }
236 this->stencilThenCoverStrokePath(id, 0xffff, writeMask, GR_GL_BOUNDI NG_BOX);
237 } else {
238 this->stencilThenCoverFillPath(id, fillMode, writeMask, GR_GL_BOUNDI NG_BOX);
239 }
240 } else {
241 if (stroke.isFillStyle() || SkStrokeRec::kStrokeAndFill_Style == stroke. getStyle()) {
242 this->stencilFillPath(id, fillMode, writeMask);
243 }
244 if (stroke.needToApply()) {
245 this->stencilStrokePath(id, 0xffff, writeMask);
246 }
247
248 GrDrawState* drawState = fGpu->drawState();
249 GrDrawState::AutoViewMatrixRestore avmr;
250 SkRect bounds = SkRect::MakeLTRB(0, 0,
251 SkIntToScalar(drawState->getRenderTarge t()->width()),
252 SkIntToScalar(drawState->getRenderTarge t()->height()));
253 SkMatrix vmi;
254 // mapRect through persp matrix may not be correct
255 if (!drawState->getViewMatrix().hasPerspective() && drawState->getViewIn verse(&vmi)) {
256 vmi.mapRect(&bounds);
257 // theoretically could set bloat = 0, instead leave it because of ma trix inversion
258 // precision.
259 SkScalar bloat = drawState->getViewMatrix().getMaxScale() * SK_Scala rHalf;
260 bounds.outset(bloat, bloat);
261 } else {
262 avmr.setIdentity(drawState);
263 }
264
265 fGpu->drawSimpleRect(bounds);
266 }
267 }
268
269 void GrGLPathRendering::drawPaths(const GrPathRange* pathRange, const uint32_t i ndices[], int count,
270 const float transforms[], PathTransformType tr ansformsType,
271 SkPath::FillType fill) {
272 SkASSERT(fGpu->caps()->pathRenderingSupport());
273 SkASSERT(NULL != fGpu->drawState()->getRenderTarget());
274 SkASSERT(NULL != fGpu->drawState()->getRenderTarget()->getStencilBuffer());
275 SkASSERT(!fGpu->fCurrentProgram->hasVertexShader());
276
277 GrGLuint baseID = static_cast<const GrGLPathRange*>(pathRange)->basePathID() ;
278
279 this->flushPathStencilSettings(fill);
280 const SkStrokeRec& stroke = pathRange->getStroke();
281
282 SkPath::FillType nonInvertedFill =
283 SkPath::ConvertToNonInverseFillType(fill);
284
285 SkASSERT(!fHWPathStencilSettings.isTwoSided());
286 GrGLenum fillMode =
287 gr_stencil_op_to_gl_path_rendering_fill_mode(
288 fHWPathStencilSettings.passOp(GrStencilSettings::kFront_Face));
289 GrGLint writeMask =
290 fHWPathStencilSettings.writeMask(GrStencilSettings::kFront_Face);
291
292 if (nonInvertedFill == fill) {
293 if (stroke.needToApply()) {
294 if (SkStrokeRec::kStrokeAndFill_Style == stroke.getStyle()) {
295 this->stencilFillPathInstanced(
296 count, GR_GL_UNSIGNED_INT, indices, baseID, fillMode,
297 writeMask, gXformType2GLType[transformsType] ,
298 transforms);
299 }
300 this->stencilThenCoverStrokePathInstanced(
301 count, GR_GL_UNSIGNED_INT, indices, baseID, 0xff ff, writeMask,
302 GR_GL_BOUNDING_BOX_OF_BOUNDING_BOXES,
303 gXformType2GLType[transformsType], transforms);
304 } else {
305 this->stencilThenCoverFillPathInstanced(
306 count, GR_GL_UNSIGNED_INT, indices, baseID, fill Mode, writeMask,
307 GR_GL_BOUNDING_BOX_OF_BOUNDING_BOXES,
308 gXformType2GLType[transformsType], transforms);
309 }
310 } else {
311 if (stroke.isFillStyle() || SkStrokeRec::kStrokeAndFill_Style == stroke. getStyle()) {
312 this->stencilFillPathInstanced(
313 count, GR_GL_UNSIGNED_INT, indices, baseID, fill Mode,
314 writeMask, gXformType2GLType[transformsType],
315 transforms);
316 }
317 if (stroke.needToApply()) {
318 this->stencilStrokePathInstanced(
319 count, GR_GL_UNSIGNED_INT, indices, baseID, 0xff ff,
320 writeMask, gXformType2GLType[transformsType],
321 transforms);
322 }
323
324 GrDrawState* drawState = fGpu->drawState();
325 GrDrawState::AutoViewMatrixRestore avmr;
326 SkRect bounds = SkRect::MakeLTRB(0, 0,
327 SkIntToScalar(drawState->getRenderTarge t()->width()),
328 SkIntToScalar(drawState->getRenderTarge t()->height()));
329 SkMatrix vmi;
330 // mapRect through persp matrix may not be correct
331 if (!drawState->getViewMatrix().hasPerspective() && drawState->getViewIn verse(&vmi)) {
332 vmi.mapRect(&bounds);
333 // theoretically could set bloat = 0, instead leave it because of ma trix inversion
334 // precision.
335 SkScalar bloat = drawState->getViewMatrix().getMaxScale() * SK_Scala rHalf;
336 bounds.outset(bloat, bloat);
337 } else {
338 avmr.setIdentity(drawState);
339 }
340
341 fGpu->drawSimpleRect(bounds);
342 }
343 }
344
345 void GrGLPathRendering::flushPathStencilSettings(SkPath::FillType fill) {
346 GrStencilSettings pathStencilSettings;
347 fGpu->getPathStencilSettingsForFillType(fill, &pathStencilSettings);
348 if (fHWPathStencilSettings != pathStencilSettings) {
349 // Just the func, ref, and mask is set here. The op and write mask are p arams to the call
350 // that draws the path to the SB (glStencilFillPath)
351 GrGLenum func =
352 GrToGLStencilFunc(pathStencilSettings.func(GrStencilSettings::kFront _Face));
353 this->pathStencilFunc(func, pathStencilSettings.funcRef(GrStencilSetting s::kFront_Face),
354 pathStencilSettings.funcMask(GrStencilSettings::kF ront_Face));
355
356 fHWPathStencilSettings = pathStencilSettings;
357 }
358 }
359
360 void GrGLPathRendering::setProjectionMatrix(const SkMatrix& matrix,
361 const SkISize& renderTargetSize,
362 GrSurfaceOrigin renderTargetOrigin) {
363
364 SkASSERT(fGpu->glCaps().pathRenderingSupport());
365
366 if (renderTargetOrigin == fHWProjectionMatrixState.fRenderTargetOrigin &&
367 renderTargetSize == fHWProjectionMatrixState.fRenderTargetSize &&
368 matrix.cheapEqualTo(fHWProjectionMatrixState.fViewMatrix)) {
369 return;
370 }
371
372 fHWProjectionMatrixState.fViewMatrix = matrix;
373 fHWProjectionMatrixState.fRenderTargetSize = renderTargetSize;
374 fHWProjectionMatrixState.fRenderTargetOrigin = renderTargetOrigin;
375
376 GrGLfloat glMatrix[4 * 4];
377 fHWProjectionMatrixState.getRTAdjustedGLMatrix<4>(glMatrix);
378 GL_CALL(MatrixLoadf(GR_GL_PROJECTION, glMatrix));
379 }
380
381
76 382
77 // NV_path_rendering 383 // NV_path_rendering
78 GrGLuint GrGLPathRendering::genPaths(GrGLsizei range) { 384 GrGLuint GrGLPathRendering::genPaths(GrGLsizei range) {
79 if (range > 1) { 385 if (range > 1) {
80 GrGLuint name; 386 GrGLuint name;
81 GL_CALL_RET(name, GenPaths(range)); 387 GL_CALL_RET(name, GenPaths(range));
82 return name; 388 return name;
83 } 389 }
84 390
85 if (NULL == fPathNameAllocator.get()) { 391 if (NULL == fPathNameAllocator.get()) {
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 GrGLboolean ret; 455 GrGLboolean ret;
150 GL_CALL_RET(ret, IsPath(path)); 456 GL_CALL_RET(ret, IsPath(path));
151 return ret; 457 return ret;
152 } 458 }
153 459
154 GrGLvoid GrGLPathRendering::pathStencilFunc(GrGLenum func, GrGLint ref, GrGLuint mask) { 460 GrGLvoid GrGLPathRendering::pathStencilFunc(GrGLenum func, GrGLint ref, GrGLuint mask) {
155 GL_CALL(PathStencilFunc(func, ref, mask)); 461 GL_CALL(PathStencilFunc(func, ref, mask));
156 } 462 }
157 463
158 GrGLvoid GrGLPathRendering::stencilFillPath(GrGLuint path, GrGLenum fillMode, Gr GLuint mask) { 464 GrGLvoid GrGLPathRendering::stencilFillPath(GrGLuint path, GrGLenum fillMode, Gr GLuint mask) {
465 // Decide how to manipulate the stencil buffer based on the fill rule.
466 SkASSERT(!fHWPathStencilSettings.isTwoSided());
Chris Dalton 2014/08/14 16:22:09 Do we need similar checks in stencil(Then)Cover(St
Kimmo Kinnunen 2014/08/15 06:19:26 Done.
467
159 GL_CALL(StencilFillPath(path, fillMode, mask)); 468 GL_CALL(StencilFillPath(path, fillMode, mask));
160 } 469 }
161 470
162 GrGLvoid GrGLPathRendering::stencilStrokePath(GrGLuint path, GrGLint reference, GrGLuint mask) { 471 GrGLvoid GrGLPathRendering::stencilStrokePath(GrGLuint path, GrGLint reference, GrGLuint mask) {
163 GL_CALL(StencilStrokePath(path, reference, mask)); 472 GL_CALL(StencilStrokePath(path, reference, mask));
164 } 473 }
165 474
166 GrGLvoid GrGLPathRendering::stencilFillPathInstanced( 475 GrGLvoid GrGLPathRendering::stencilFillPathInstanced(
167 GrGLsizei numPaths, GrGLenum pathNameType, const GrGLvoid *paths, 476 GrGLsizei numPaths, GrGLenum pathNameType, const GrGLvoid *paths,
168 GrGLuint pathBase, GrGLenum fillMode, GrGLuint mask, 477 GrGLuint pathBase, GrGLenum fillMode, GrGLuint mask,
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 mask, coverMode, transformType, transformValues)); 581 mask, coverMode, transformType, transformValues));
273 } 582 }
274 583
275 584
276 // NV_path_rendering v1.3 585 // NV_path_rendering v1.3
277 GrGLvoid GrGLPathRenderingV13::programPathFragmentInputGen( 586 GrGLvoid GrGLPathRenderingV13::programPathFragmentInputGen(
278 GrGLuint program, GrGLint location, GrGLenum genMode, 587 GrGLuint program, GrGLint location, GrGLenum genMode,
279 GrGLint components, const GrGLfloat *coeffs) { 588 GrGLint components, const GrGLfloat *coeffs) {
280 GL_CALL(ProgramPathFragmentInputGen(program, location, genMode, components, coeffs)); 589 GL_CALL(ProgramPathFragmentInputGen(program, location, genMode, components, coeffs));
281 } 590 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698