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

Unified Diff: src/gpu/gl/GrGLPathRendering.cpp

Issue 450283002: Simplify GrGLPathRendering interface (Closed) Base URL: https://skia.googlesource.com/skia.git@02-path-state-to-pathrendering-class
Patch Set: rebase 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/gl/GrGLPathRendering.h ('k') | src/gpu/gl/GrGpuGL.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/gl/GrGLPathRendering.cpp
diff --git a/src/gpu/gl/GrGLPathRendering.cpp b/src/gpu/gl/GrGLPathRendering.cpp
index 53d7cf007411ab4fbc7dcd3bf55f5ac2b5915d5c..135eb16866d9ad7f91d8ea4ee261fc56b5db6c7b 100644
--- a/src/gpu/gl/GrGLPathRendering.cpp
+++ b/src/gpu/gl/GrGLPathRendering.cpp
@@ -45,58 +45,16 @@ static GrGLenum gr_stencil_op_to_gl_path_rendering_fill_mode(GrStencilOp op) {
}
}
-class GrGLPathRenderingV12 : public GrGLPathRendering {
-public:
- GrGLPathRenderingV12(GrGpuGL* gpu)
- : GrGLPathRendering(gpu) {
- }
-
- virtual GrGLvoid stencilThenCoverFillPath(GrGLuint path, GrGLenum fillMode,
- GrGLuint mask, GrGLenum coverMode) SK_OVERRIDE;
- virtual GrGLvoid stencilThenCoverStrokePath(GrGLuint path, GrGLint reference,
- GrGLuint mask, GrGLenum coverMode) SK_OVERRIDE;
- virtual GrGLvoid stencilThenCoverFillPathInstanced(
- GrGLsizei numPaths, GrGLenum pathNameType, const GrGLvoid *paths,
- GrGLuint pathBase, GrGLenum fillMode, GrGLuint mask, GrGLenum coverMode,
- GrGLenum transformType, const GrGLfloat *transformValues) SK_OVERRIDE;
- virtual GrGLvoid stencilThenCoverStrokePathInstanced(
- GrGLsizei numPaths, GrGLenum pathNameType, const GrGLvoid *paths,
- GrGLuint pathBase, GrGLint reference, GrGLuint mask, GrGLenum coverMode,
- GrGLenum transformType, const GrGLfloat *transformValues) SK_OVERRIDE;
-};
-
-class GrGLPathRenderingV13 : public GrGLPathRenderingV12 {
-public:
- GrGLPathRenderingV13(GrGpuGL* gpu)
- : GrGLPathRenderingV12(gpu) {
- fCaps.fragmentInputGenSupport = true;
- }
-
- virtual GrGLvoid programPathFragmentInputGen(GrGLuint program, GrGLint location,
- GrGLenum genMode, GrGLint components,
- const GrGLfloat *coeffs) SK_OVERRIDE;
-};
-
-
-GrGLPathRendering* GrGLPathRendering::Create(GrGpuGL* gpu) {
- const GrGLInterface* glInterface = gpu->glInterface();
- if (NULL == glInterface->fFunctions.fStencilThenCoverFillPath ||
- NULL == glInterface->fFunctions.fStencilThenCoverStrokePath ||
- NULL == glInterface->fFunctions.fStencilThenCoverFillPathInstanced ||
- NULL == glInterface->fFunctions.fStencilThenCoverStrokePathInstanced) {
- return new GrGLPathRendering(gpu);
- }
-
- if (NULL == glInterface->fFunctions.fProgramPathFragmentInputGen) {
- return new GrGLPathRenderingV12(gpu);
- }
-
- return new GrGLPathRenderingV13(gpu);
-}
-
GrGLPathRendering::GrGLPathRendering(GrGpuGL* gpu)
: fGpu(gpu) {
- memset(&fCaps, 0, sizeof(fCaps));
+ const GrGLInterface* glInterface = gpu->glInterface();
+ fCaps.stencilThenCoverSupport =
+ NULL != glInterface->fFunctions.fStencilThenCoverFillPath &&
+ NULL != glInterface->fFunctions.fStencilThenCoverStrokePath &&
+ NULL != glInterface->fFunctions.fStencilThenCoverFillPathInstanced &&
+ NULL != glInterface->fFunctions.fStencilThenCoverStrokePathInstanced;
+ fCaps.fragmentInputGenSupport =
+ NULL != glInterface->fFunctions.fProgramPathFragmentInputGen;
fHWPathTexGenSettings.reset(fGpu->glCaps().maxFixedFunctionTextureCoords());
}
@@ -113,7 +71,7 @@ void GrGLPathRendering::resetContext() {
GL_CALL(MatrixLoadIdentity(GR_GL_MODELVIEW));
for (int i = 0; i < fGpu->glCaps().maxFixedFunctionTextureCoords(); ++i) {
- this->pathTexGen(GR_GL_TEXTURE0 + i, GR_GL_NONE, 0, NULL);
+ GL_CALL(PathTexGen(GR_GL_TEXTURE0 + i, GR_GL_NONE, 0, NULL));
fHWPathTexGenSettings[i].fMode = GR_GL_NONE;
fHWPathTexGenSettings[i].fNumComponents = 0;
}
@@ -129,76 +87,6 @@ GrPathRange* GrGLPathRendering::createPathRange(size_t size, const SkStrokeRec&
return SkNEW_ARGS(GrGLPathRange, (fGpu, size, stroke));
}
-void GrGLPathRendering::enablePathTexGen(int unitIdx, PathTexGenComponents components,
- const GrGLfloat* coefficients) {
- SkASSERT(components >= kS_PathTexGenComponents &&
- components <= kSTR_PathTexGenComponents);
- SkASSERT(fGpu->glCaps().maxFixedFunctionTextureCoords() >= unitIdx);
-
- if (GR_GL_OBJECT_LINEAR == fHWPathTexGenSettings[unitIdx].fMode &&
- components == fHWPathTexGenSettings[unitIdx].fNumComponents &&
- !memcmp(coefficients, fHWPathTexGenSettings[unitIdx].fCoefficients,
- 3 * components * sizeof(GrGLfloat))) {
- return;
- }
-
- fGpu->setTextureUnit(unitIdx);
-
- fHWPathTexGenSettings[unitIdx].fNumComponents = components;
- this->pathTexGen(GR_GL_TEXTURE0 + unitIdx, GR_GL_OBJECT_LINEAR, components, coefficients);
-
- memcpy(fHWPathTexGenSettings[unitIdx].fCoefficients, coefficients,
- 3 * components * sizeof(GrGLfloat));
-}
-
-void GrGLPathRendering::enablePathTexGen(int unitIdx, PathTexGenComponents components,
- const SkMatrix& matrix) {
- GrGLfloat coefficients[3 * 3];
- SkASSERT(components >= kS_PathTexGenComponents &&
- components <= kSTR_PathTexGenComponents);
-
- coefficients[0] = SkScalarToFloat(matrix[SkMatrix::kMScaleX]);
- coefficients[1] = SkScalarToFloat(matrix[SkMatrix::kMSkewX]);
- coefficients[2] = SkScalarToFloat(matrix[SkMatrix::kMTransX]);
-
- if (components >= kST_PathTexGenComponents) {
- coefficients[3] = SkScalarToFloat(matrix[SkMatrix::kMSkewY]);
- coefficients[4] = SkScalarToFloat(matrix[SkMatrix::kMScaleY]);
- coefficients[5] = SkScalarToFloat(matrix[SkMatrix::kMTransY]);
- }
-
- if (components >= kSTR_PathTexGenComponents) {
- coefficients[6] = SkScalarToFloat(matrix[SkMatrix::kMPersp0]);
- coefficients[7] = SkScalarToFloat(matrix[SkMatrix::kMPersp1]);
- coefficients[8] = SkScalarToFloat(matrix[SkMatrix::kMPersp2]);
- }
-
- this->enablePathTexGen(unitIdx, components, coefficients);
-}
-
-void GrGLPathRendering::flushPathTexGenSettings(int numUsedTexCoordSets) {
- SkASSERT(fGpu->glCaps().maxFixedFunctionTextureCoords() >= numUsedTexCoordSets);
-
- // Only write the inactive path tex gens, since active path tex gens were
- // written when they were enabled.
-
- SkDEBUGCODE(
- for (int i = 0; i < numUsedTexCoordSets; i++) {
- SkASSERT(0 != fHWPathTexGenSettings[i].fNumComponents);
- }
- );
-
- for (int i = numUsedTexCoordSets; i < fHWActivePathTexGenSets; i++) {
- SkASSERT(0 != fHWPathTexGenSettings[i].fNumComponents);
-
- fGpu->setTextureUnit(i);
- GL_CALL(PathTexGen(GR_GL_TEXTURE0 + i, GR_GL_NONE, 0, NULL));
- fHWPathTexGenSettings[i].fNumComponents = 0;
- }
-
- fHWActivePathTexGenSets = numUsedTexCoordSets;
-}
-
void GrGLPathRendering::stencilPath(const GrPath* path, SkPath::FillType fill) {
GrGLuint id = static_cast<const GrGLPath*>(path)->pathID();
SkASSERT(NULL != fGpu->drawState()->getRenderTarget());
@@ -210,7 +98,7 @@ void GrGLPathRendering::stencilPath(const GrPath* path, SkPath::FillType fill) {
GrGLenum fillMode =
gr_stencil_op_to_gl_path_rendering_fill_mode(fHWPathStencilSettings.passOp(GrStencilSettings::kFront_Face));
GrGLint writeMask = fHWPathStencilSettings.writeMask(GrStencilSettings::kFront_Face);
- this->stencilFillPath(id, fillMode, writeMask);
+ GL_CALL(StencilFillPath(id, fillMode, writeMask));
}
void GrGLPathRendering::drawPath(const GrPath* path, SkPath::FillType fill) {
@@ -233,7 +121,7 @@ void GrGLPathRendering::drawPath(const GrPath* path, SkPath::FillType fill) {
if (nonInvertedFill == fill) {
if (stroke.needToApply()) {
if (SkStrokeRec::kStrokeAndFill_Style == stroke.getStyle()) {
- this->stencilFillPath(id, fillMode, writeMask);
+ GL_CALL(StencilFillPath(id, fillMode, writeMask));
}
this->stencilThenCoverStrokePath(id, 0xffff, writeMask, GR_GL_BOUNDING_BOX);
} else {
@@ -241,10 +129,10 @@ void GrGLPathRendering::drawPath(const GrPath* path, SkPath::FillType fill) {
}
} else {
if (stroke.isFillStyle() || SkStrokeRec::kStrokeAndFill_Style == stroke.getStyle()) {
- this->stencilFillPath(id, fillMode, writeMask);
+ GL_CALL(StencilFillPath(id, fillMode, writeMask));
}
if (stroke.needToApply()) {
- this->stencilStrokePath(id, 0xffff, writeMask);
+ GL_CALL(StencilStrokePath(id, 0xffff, writeMask));
}
GrDrawState* drawState = fGpu->drawState();
@@ -295,10 +183,10 @@ void GrGLPathRendering::drawPaths(const GrPathRange* pathRange, const uint32_t i
if (nonInvertedFill == fill) {
if (stroke.needToApply()) {
if (SkStrokeRec::kStrokeAndFill_Style == stroke.getStyle()) {
- this->stencilFillPathInstanced(
- count, GR_GL_UNSIGNED_INT, indices, baseID, fillMode,
- writeMask, gXformType2GLType[transformsType],
- transforms);
+ GL_CALL(StencilFillPathInstanced(
+ count, GR_GL_UNSIGNED_INT, indices, baseID, fillMode,
+ writeMask, gXformType2GLType[transformsType],
+ transforms));
}
this->stencilThenCoverStrokePathInstanced(
count, GR_GL_UNSIGNED_INT, indices, baseID, 0xffff, writeMask,
@@ -312,16 +200,16 @@ void GrGLPathRendering::drawPaths(const GrPathRange* pathRange, const uint32_t i
}
} else {
if (stroke.isFillStyle() || SkStrokeRec::kStrokeAndFill_Style == stroke.getStyle()) {
- this->stencilFillPathInstanced(
+ GL_CALL(StencilFillPathInstanced(
count, GR_GL_UNSIGNED_INT, indices, baseID, fillMode,
writeMask, gXformType2GLType[transformsType],
- transforms);
+ transforms));
}
if (stroke.needToApply()) {
- this->stencilStrokePathInstanced(
+ GL_CALL(StencilStrokePathInstanced(
count, GR_GL_UNSIGNED_INT, indices, baseID, 0xffff,
writeMask, gXformType2GLType[transformsType],
- transforms);
+ transforms));
}
GrDrawState* drawState = fGpu->drawState();
@@ -345,19 +233,100 @@ void GrGLPathRendering::drawPaths(const GrPathRange* pathRange, const uint32_t i
}
}
-void GrGLPathRendering::flushPathStencilSettings(SkPath::FillType fill) {
- GrStencilSettings pathStencilSettings;
- fGpu->getPathStencilSettingsForFillType(fill, &pathStencilSettings);
- if (fHWPathStencilSettings != pathStencilSettings) {
- // Just the func, ref, and mask is set here. The op and write mask are params to the call
- // that draws the path to the SB (glStencilFillPath)
- GrGLenum func =
- GrToGLStencilFunc(pathStencilSettings.func(GrStencilSettings::kFront_Face));
- this->pathStencilFunc(func, pathStencilSettings.funcRef(GrStencilSettings::kFront_Face),
- pathStencilSettings.funcMask(GrStencilSettings::kFront_Face));
+void GrGLPathRendering::enablePathTexGen(int unitIdx, PathTexGenComponents components,
+ const GrGLfloat* coefficients) {
+ SkASSERT(components >= kS_PathTexGenComponents &&
+ components <= kSTR_PathTexGenComponents);
+ SkASSERT(fGpu->glCaps().maxFixedFunctionTextureCoords() >= unitIdx);
- fHWPathStencilSettings = pathStencilSettings;
+ if (GR_GL_OBJECT_LINEAR == fHWPathTexGenSettings[unitIdx].fMode &&
+ components == fHWPathTexGenSettings[unitIdx].fNumComponents &&
+ !memcmp(coefficients, fHWPathTexGenSettings[unitIdx].fCoefficients,
+ 3 * components * sizeof(GrGLfloat))) {
+ return;
}
+
+ fGpu->setTextureUnit(unitIdx);
+
+ fHWPathTexGenSettings[unitIdx].fNumComponents = components;
+ GL_CALL(PathTexGen(GR_GL_TEXTURE0 + unitIdx, GR_GL_OBJECT_LINEAR, components, coefficients));
+
+ memcpy(fHWPathTexGenSettings[unitIdx].fCoefficients, coefficients,
+ 3 * components * sizeof(GrGLfloat));
+}
+
+void GrGLPathRendering::enablePathTexGen(int unitIdx, PathTexGenComponents components,
+ const SkMatrix& matrix) {
+ GrGLfloat coefficients[3 * 3];
+ SkASSERT(components >= kS_PathTexGenComponents &&
+ components <= kSTR_PathTexGenComponents);
+
+ coefficients[0] = SkScalarToFloat(matrix[SkMatrix::kMScaleX]);
+ coefficients[1] = SkScalarToFloat(matrix[SkMatrix::kMSkewX]);
+ coefficients[2] = SkScalarToFloat(matrix[SkMatrix::kMTransX]);
+
+ if (components >= kST_PathTexGenComponents) {
+ coefficients[3] = SkScalarToFloat(matrix[SkMatrix::kMSkewY]);
+ coefficients[4] = SkScalarToFloat(matrix[SkMatrix::kMScaleY]);
+ coefficients[5] = SkScalarToFloat(matrix[SkMatrix::kMTransY]);
+ }
+
+ if (components >= kSTR_PathTexGenComponents) {
+ coefficients[6] = SkScalarToFloat(matrix[SkMatrix::kMPersp0]);
+ coefficients[7] = SkScalarToFloat(matrix[SkMatrix::kMPersp1]);
+ coefficients[8] = SkScalarToFloat(matrix[SkMatrix::kMPersp2]);
+ }
+
+ this->enablePathTexGen(unitIdx, components, coefficients);
+}
+
+void GrGLPathRendering::flushPathTexGenSettings(int numUsedTexCoordSets) {
+ SkASSERT(fGpu->glCaps().maxFixedFunctionTextureCoords() >= numUsedTexCoordSets);
+
+ // Only write the inactive path tex gens, since active path tex gens were
+ // written when they were enabled.
+
+ SkDEBUGCODE(
+ for (int i = 0; i < numUsedTexCoordSets; i++) {
+ SkASSERT(0 != fHWPathTexGenSettings[i].fNumComponents);
+ }
+ );
+
+ for (int i = numUsedTexCoordSets; i < fHWActivePathTexGenSets; i++) {
+ SkASSERT(0 != fHWPathTexGenSettings[i].fNumComponents);
+
+ fGpu->setTextureUnit(i);
+ GL_CALL(PathTexGen(GR_GL_TEXTURE0 + i, GR_GL_NONE, 0, NULL));
+ fHWPathTexGenSettings[i].fNumComponents = 0;
+ }
+
+ fHWActivePathTexGenSets = numUsedTexCoordSets;
+}
+
+void GrGLPathRendering::setProgramPathFragmentInputTransform(GrGLuint program, GrGLint location,
+ GrGLenum genMode, GrGLint components,
+ const SkMatrix& matrix) {
+ SkASSERT(caps().fragmentInputGenSupport);
+ GrGLfloat coefficients[3 * 3];
+ SkASSERT(components >= 1 && components <= 3);
+
+ coefficients[0] = SkScalarToFloat(matrix[SkMatrix::kMScaleX]);
+ coefficients[1] = SkScalarToFloat(matrix[SkMatrix::kMSkewX]);
+ coefficients[2] = SkScalarToFloat(matrix[SkMatrix::kMTransX]);
+
+ if (components >= 2) {
+ coefficients[3] = SkScalarToFloat(matrix[SkMatrix::kMSkewY]);
+ coefficients[4] = SkScalarToFloat(matrix[SkMatrix::kMScaleY]);
+ coefficients[5] = SkScalarToFloat(matrix[SkMatrix::kMTransY]);
+ }
+
+ if (components >= 3) {
+ coefficients[6] = SkScalarToFloat(matrix[SkMatrix::kMPersp0]);
+ coefficients[7] = SkScalarToFloat(matrix[SkMatrix::kMPersp1]);
+ coefficients[8] = SkScalarToFloat(matrix[SkMatrix::kMPersp2]);
+ }
+
+ GL_CALL(ProgramPathFragmentInputGen(program, location, genMode, components, coefficients));
}
void GrGLPathRendering::setProjectionMatrix(const SkMatrix& matrix,
@@ -381,9 +350,6 @@ void GrGLPathRendering::setProjectionMatrix(const SkMatrix& matrix,
GL_CALL(MatrixLoadf(GR_GL_PROJECTION, glMatrix));
}
-
-
-// NV_path_rendering
GrGLuint GrGLPathRendering::genPaths(GrGLsizei range) {
if (range > 1) {
GrGLuint name;
@@ -410,7 +376,7 @@ GrGLuint GrGLPathRendering::genPaths(GrGLsizei range) {
return name;
}
-GrGLvoid GrGLPathRendering::deletePaths(GrGLuint path, GrGLsizei range) {
+void GrGLPathRendering::deletePaths(GrGLuint path, GrGLsizei range) {
if (range > 1) {
// It is not supported to delete names in ranges that were allocated
// individually using GrGLPathNameAllocator.
@@ -435,157 +401,69 @@ GrGLvoid GrGLPathRendering::deletePaths(GrGLuint path, GrGLsizei range) {
fPathNameAllocator->free(path);
}
-GrGLvoid GrGLPathRendering::pathCommands(GrGLuint path, GrGLsizei numCommands,
- const GrGLubyte *commands, GrGLsizei numCoords,
- GrGLenum coordType, const GrGLvoid *coords) {
- GL_CALL(PathCommands(path, numCommands, commands, numCoords, coordType, coords));
-}
-
-GrGLvoid GrGLPathRendering::pathCoords(GrGLuint path, GrGLsizei numCoords,
- GrGLenum coordType, const GrGLvoid *coords) {
- GL_CALL(PathCoords(path, numCoords, coordType, coords));
-}
-
-GrGLvoid GrGLPathRendering::pathParameteri(GrGLuint path, GrGLenum pname, GrGLint value) {
- GL_CALL(PathParameteri(path, pname, value));
-}
-
-GrGLvoid GrGLPathRendering::pathParameterf(GrGLuint path, GrGLenum pname, GrGLfloat value) {
- GL_CALL(PathParameterf(path, pname, value));
-}
-
-GrGLboolean GrGLPathRendering::isPath(GrGLuint path) {
- GrGLboolean ret;
- GL_CALL_RET(ret, IsPath(path));
- return ret;
-}
-
-GrGLvoid GrGLPathRendering::pathStencilFunc(GrGLenum func, GrGLint ref, GrGLuint mask) {
- GL_CALL(PathStencilFunc(func, ref, mask));
-}
-
-GrGLvoid GrGLPathRendering::stencilFillPath(GrGLuint path, GrGLenum fillMode, GrGLuint mask) {
- // Decide how to manipulate the stencil buffer based on the fill rule.
- GL_CALL(StencilFillPath(path, fillMode, mask));
-}
-
-GrGLvoid GrGLPathRendering::stencilStrokePath(GrGLuint path, GrGLint reference, GrGLuint mask) {
- GL_CALL(StencilStrokePath(path, reference, mask));
-}
-
-GrGLvoid GrGLPathRendering::stencilFillPathInstanced(
- GrGLsizei numPaths, GrGLenum pathNameType, const GrGLvoid *paths,
- GrGLuint pathBase, GrGLenum fillMode, GrGLuint mask,
- GrGLenum transformType, const GrGLfloat *transformValues) {
- GL_CALL(StencilFillPathInstanced(numPaths, pathNameType, paths, pathBase,
- fillMode, mask, transformType, transformValues));
-}
-
-GrGLvoid GrGLPathRendering::stencilStrokePathInstanced(
- GrGLsizei numPaths, GrGLenum pathNameType, const GrGLvoid *paths,
- GrGLuint pathBase, GrGLint reference, GrGLuint mask,
- GrGLenum transformType, const GrGLfloat *transformValues) {
- GL_CALL(StencilStrokePathInstanced(numPaths, pathNameType, paths, pathBase,
- reference, mask, transformType, transformValues));
-}
-
-GrGLvoid GrGLPathRendering::pathTexGen(GrGLenum texCoordSet, GrGLenum genMode,
- GrGLint components, const GrGLfloat *coeffs) {
- GL_CALL(PathTexGen(texCoordSet, genMode, components, coeffs));
-}
-
-GrGLvoid GrGLPathRendering::coverFillPath(GrGLuint path, GrGLenum coverMode) {
- GL_CALL(CoverFillPath(path, coverMode));
-}
-
-GrGLvoid GrGLPathRendering::coverStrokePath(GrGLuint name, GrGLenum coverMode) {
- GL_CALL(CoverStrokePath(name, coverMode));
-}
-
-GrGLvoid GrGLPathRendering::coverFillPathInstanced(
- GrGLsizei numPaths, GrGLenum pathNameType, const GrGLvoid *paths, GrGLuint pathBase,
- GrGLenum coverMode, GrGLenum transformType, const GrGLfloat *transformValues) {
- GL_CALL(CoverFillPathInstanced(numPaths, pathNameType, paths, pathBase,
- coverMode, transformType, transformValues));
-}
+void GrGLPathRendering::flushPathStencilSettings(SkPath::FillType fill) {
+ GrStencilSettings pathStencilSettings;
+ fGpu->getPathStencilSettingsForFillType(fill, &pathStencilSettings);
+ if (fHWPathStencilSettings != pathStencilSettings) {
+ // Just the func, ref, and mask is set here. The op and write mask are params to the call
+ // that draws the path to the SB (glStencilFillPath)
+ GrGLenum func =
+ GrToGLStencilFunc(pathStencilSettings.func(GrStencilSettings::kFront_Face));
+ GL_CALL(PathStencilFunc(func, pathStencilSettings.funcRef(GrStencilSettings::kFront_Face),
+ pathStencilSettings.funcMask(GrStencilSettings::kFront_Face)));
-GrGLvoid GrGLPathRendering::coverStrokePathInstanced(
- GrGLsizei numPaths, GrGLenum pathNameType, const GrGLvoid *paths, GrGLuint pathBase,
- GrGLenum coverMode, GrGLenum transformType, const GrGLfloat* transformValues) {
- GL_CALL(CoverStrokePathInstanced(numPaths, pathNameType, paths, pathBase,
- coverMode, transformType, transformValues));
+ fHWPathStencilSettings = pathStencilSettings;
+ }
}
-GrGLvoid GrGLPathRendering::stencilThenCoverFillPath(GrGLuint path, GrGLenum fillMode,
+inline void GrGLPathRendering::stencilThenCoverFillPath(GrGLuint path, GrGLenum fillMode,
GrGLuint mask, GrGLenum coverMode) {
+ if (caps().stencilThenCoverSupport) {
+ GL_CALL(StencilThenCoverFillPath(path, fillMode, mask, coverMode));
+ return;
+ }
GL_CALL(StencilFillPath(path, fillMode, mask));
GL_CALL(CoverFillPath(path, coverMode));
}
-GrGLvoid GrGLPathRendering::stencilThenCoverStrokePath(GrGLuint path, GrGLint reference,
+inline void GrGLPathRendering::stencilThenCoverStrokePath(GrGLuint path, GrGLint reference,
GrGLuint mask, GrGLenum coverMode) {
+ if (caps().stencilThenCoverSupport) {
+ GL_CALL(StencilThenCoverStrokePath(path, reference, mask, coverMode));
+ return;
+ }
GL_CALL(StencilStrokePath(path, reference, mask));
GL_CALL(CoverStrokePath(path, coverMode));
}
-GrGLvoid GrGLPathRendering::stencilThenCoverFillPathInstanced(
+inline void GrGLPathRendering::stencilThenCoverFillPathInstanced(
GrGLsizei numPaths, GrGLenum pathNameType, const GrGLvoid *paths,
GrGLuint pathBase, GrGLenum fillMode, GrGLuint mask, GrGLenum coverMode,
GrGLenum transformType, const GrGLfloat *transformValues) {
+ if (caps().stencilThenCoverSupport) {
+ GL_CALL(StencilThenCoverFillPathInstanced(numPaths, pathNameType, paths, pathBase, fillMode,
+ mask, coverMode, transformType, transformValues));
+ return;
+ }
GL_CALL(StencilFillPathInstanced(numPaths, pathNameType, paths, pathBase,
fillMode, mask, transformType, transformValues));
GL_CALL(CoverFillPathInstanced(numPaths, pathNameType, paths, pathBase,
coverMode, transformType, transformValues));
}
-GrGLvoid GrGLPathRendering::stencilThenCoverStrokePathInstanced(
- GrGLsizei numPaths, GrGLenum pathNameType, const GrGLvoid *paths,
- GrGLuint pathBase, GrGLint reference, GrGLuint mask, GrGLenum coverMode,
- GrGLenum transformType, const GrGLfloat *transformValues) {
+inline void GrGLPathRendering::stencilThenCoverStrokePathInstanced(
+ GrGLsizei numPaths, GrGLenum pathNameType, const GrGLvoid *paths,
+ GrGLuint pathBase, GrGLint reference, GrGLuint mask, GrGLenum coverMode,
+ GrGLenum transformType, const GrGLfloat *transformValues) {
+ if (caps().stencilThenCoverSupport) {
+ GL_CALL(StencilThenCoverStrokePathInstanced(numPaths, pathNameType, paths, pathBase,
+ reference, mask, coverMode, transformType,
+ transformValues));
+ return;
+ }
+
GL_CALL(StencilStrokePathInstanced(numPaths, pathNameType, paths, pathBase,
reference, mask, transformType, transformValues));
GL_CALL(CoverStrokePathInstanced(numPaths, pathNameType, paths, pathBase,
coverMode, transformType, transformValues));
}
-
-GrGLvoid GrGLPathRendering::programPathFragmentInputGen(
- GrGLuint program, GrGLint location, GrGLenum genMode,
- GrGLint components, const GrGLfloat *coeffs) {
- SkFAIL("ProgramPathFragmentInputGen not supported in this GL context.");
-}
-
-
-// NV_path_rendering v1.2
-GrGLvoid GrGLPathRenderingV12::stencilThenCoverFillPath(GrGLuint path, GrGLenum fillMode,
- GrGLuint mask, GrGLenum coverMode) {
- GL_CALL(StencilThenCoverFillPath(path, fillMode, mask, coverMode));
-}
-
-GrGLvoid GrGLPathRenderingV12::stencilThenCoverStrokePath(GrGLuint path, GrGLint reference,
- GrGLuint mask, GrGLenum coverMode) {
- GL_CALL(StencilThenCoverStrokePath(path, reference, mask, coverMode));
-}
-
-GrGLvoid GrGLPathRenderingV12::stencilThenCoverFillPathInstanced(
- GrGLsizei numPaths, GrGLenum pathNameType, const GrGLvoid *paths,
- GrGLuint pathBase, GrGLenum fillMode, GrGLuint mask, GrGLenum coverMode,
- GrGLenum transformType, const GrGLfloat *transformValues) {
- GL_CALL(StencilThenCoverFillPathInstanced(numPaths, pathNameType, paths, pathBase, fillMode,
- mask, coverMode, transformType, transformValues));
-}
-
-GrGLvoid GrGLPathRenderingV12::stencilThenCoverStrokePathInstanced(
- GrGLsizei numPaths, GrGLenum pathNameType, const GrGLvoid *paths,
- GrGLuint pathBase, GrGLint reference, GrGLuint mask, GrGLenum coverMode,
- GrGLenum transformType, const GrGLfloat *transformValues) {
- GL_CALL(StencilThenCoverStrokePathInstanced(numPaths, pathNameType, paths, pathBase, reference,
- mask, coverMode, transformType, transformValues));
-}
-
-
-// NV_path_rendering v1.3
-GrGLvoid GrGLPathRenderingV13::programPathFragmentInputGen(
- GrGLuint program, GrGLint location, GrGLenum genMode,
- GrGLint components, const GrGLfloat *coeffs) {
- GL_CALL(ProgramPathFragmentInputGen(program, location, genMode, components, coeffs));
-}
« no previous file with comments | « src/gpu/gl/GrGLPathRendering.h ('k') | src/gpu/gl/GrGpuGL.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698