cdalton | c7103a1 | 2014-08-11 14:05:05 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2014 Google Inc. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license that can be |
| 5 | * found in the LICENSE file. |
| 6 | */ |
| 7 | |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 8 | #include "include/core/SkStream.h" |
| 9 | #include "include/core/SkTypeface.h" |
Michael Ludwig | fbe2859 | 2020-06-26 16:02:15 -0400 | [diff] [blame] | 10 | #include "src/core/SkMatrixPriv.h" |
Chris Dalton | 2e7ed26 | 2020-02-21 15:17:59 -0700 | [diff] [blame] | 11 | #include "src/gpu/GrProgramInfo.h" |
| 12 | #include "src/gpu/GrRenderTargetProxy.h" |
| 13 | #include "src/gpu/gl/GrGLGpu.h" |
| 14 | #include "src/gpu/gl/GrGLPath.h" |
| 15 | #include "src/gpu/gl/GrGLPathRendering.h" |
| 16 | #include "src/gpu/gl/GrGLUtil.h" |
cdalton | 855d83f | 2014-09-18 13:51:53 -0700 | [diff] [blame] | 17 | |
kkinnunen | cabe20c | 2015-06-01 01:37:26 -0700 | [diff] [blame] | 18 | #define GL_CALL(X) GR_GL_CALL(this->gpu()->glInterface(), X) |
| 19 | #define GL_CALL_RET(RET, X) GR_GL_CALL_RET(this->gpu()->glInterface(), RET, X) |
kkinnunen | ccdaa04 | 2014-08-20 01:36:23 -0700 | [diff] [blame] | 20 | |
kkinnunen | 702501d | 2016-01-13 23:36:45 -0800 | [diff] [blame] | 21 | // Number of paths to allocate per glGenPaths call. The call can be overly slow on command buffer GL |
| 22 | // implementation. The call has a result value, and thus waiting for the call completion is needed. |
| 23 | static const GrGLsizei kPathIDPreallocationAmount = 65536; |
kkinnunen | ccdaa04 | 2014-08-20 01:36:23 -0700 | [diff] [blame] | 24 | |
Brian Salomon | 4dea72a | 2019-12-18 10:43:10 -0500 | [diff] [blame] | 25 | static_assert(0 == GrPathRendering::kNone_PathTransformType); |
| 26 | static_assert(1 == GrPathRendering::kTranslateX_PathTransformType); |
| 27 | static_assert(2 == GrPathRendering::kTranslateY_PathTransformType); |
| 28 | static_assert(3 == GrPathRendering::kTranslate_PathTransformType); |
| 29 | static_assert(4 == GrPathRendering::kAffine_PathTransformType); |
| 30 | static_assert(GrPathRendering::kAffine_PathTransformType == GrPathRendering::kLast_PathTransformType); |
kkinnunen | ccdaa04 | 2014-08-20 01:36:23 -0700 | [diff] [blame] | 31 | |
kkinnunen | 68c63b3 | 2016-03-04 00:12:33 -0800 | [diff] [blame] | 32 | #ifdef SK_DEBUG |
kkinnunen | 68c63b3 | 2016-03-04 00:12:33 -0800 | [diff] [blame] | 33 | |
| 34 | static void verify_floats(const float* floats, int count) { |
| 35 | for (int i = 0; i < count; ++i) { |
| 36 | SkASSERT(!SkScalarIsNaN(SkFloatToScalar(floats[i]))); |
| 37 | } |
| 38 | } |
| 39 | #endif |
| 40 | |
kkinnunen | ccdaa04 | 2014-08-20 01:36:23 -0700 | [diff] [blame] | 41 | static GrGLenum gr_stencil_op_to_gl_path_rendering_fill_mode(GrStencilOp op) { |
| 42 | switch (op) { |
| 43 | default: |
Ben Wagner | b4aab9a | 2017-08-16 10:53:04 -0400 | [diff] [blame] | 44 | SK_ABORT("Unexpected path fill."); |
Brian Salomon | 2335644 | 2018-11-30 15:33:19 -0500 | [diff] [blame] | 45 | /* fallthrough */ |
cdalton | 193d9cf | 2016-05-12 11:52:02 -0700 | [diff] [blame] | 46 | case GrStencilOp::kIncWrap: |
kkinnunen | ccdaa04 | 2014-08-20 01:36:23 -0700 | [diff] [blame] | 47 | return GR_GL_COUNT_UP; |
cdalton | 93a379b | 2016-05-11 13:58:08 -0700 | [diff] [blame] | 48 | case GrStencilOp::kInvert: |
kkinnunen | ccdaa04 | 2014-08-20 01:36:23 -0700 | [diff] [blame] | 49 | return GR_GL_INVERT; |
| 50 | } |
| 51 | } |
cdalton | c7103a1 | 2014-08-11 14:05:05 -0700 | [diff] [blame] | 52 | |
bsalomon | 861e103 | 2014-12-16 07:33:49 -0800 | [diff] [blame] | 53 | GrGLPathRendering::GrGLPathRendering(GrGLGpu* gpu) |
kkinnunen | 702501d | 2016-01-13 23:36:45 -0800 | [diff] [blame] | 54 | : GrPathRendering(gpu) |
| 55 | , fPreallocatedPathCount(0) { |
kkinnunen | 6bb6d40 | 2015-07-14 10:59:23 -0700 | [diff] [blame] | 56 | const GrGLInterface* glInterface = gpu->glInterface(); |
Mike Klein | 7634330 | 2017-06-22 13:15:13 -0700 | [diff] [blame] | 57 | fCaps.bindFragmentInputSupport = (bool)glInterface->fFunctions.fBindFragmentInputLocation; |
cdalton | c7103a1 | 2014-08-11 14:05:05 -0700 | [diff] [blame] | 58 | } |
| 59 | |
| 60 | GrGLPathRendering::~GrGLPathRendering() { |
kkinnunen | 702501d | 2016-01-13 23:36:45 -0800 | [diff] [blame] | 61 | if (fPreallocatedPathCount > 0) { |
| 62 | this->deletePaths(fFirstPreallocatedPathID, fPreallocatedPathCount); |
| 63 | } |
cdalton | c7103a1 | 2014-08-11 14:05:05 -0700 | [diff] [blame] | 64 | } |
| 65 | |
bsalomon | 6e2aad4 | 2016-04-01 11:54:31 -0700 | [diff] [blame] | 66 | void GrGLPathRendering::disconnect(GrGpu::DisconnectType type) { |
| 67 | if (GrGpu::DisconnectType::kCleanup == type) { |
| 68 | this->deletePaths(fFirstPreallocatedPathID, fPreallocatedPathCount); |
Brian Salomon | 2335644 | 2018-11-30 15:33:19 -0500 | [diff] [blame] | 69 | } |
kkinnunen | 702501d | 2016-01-13 23:36:45 -0800 | [diff] [blame] | 70 | fPreallocatedPathCount = 0; |
cdalton | c7103a1 | 2014-08-11 14:05:05 -0700 | [diff] [blame] | 71 | } |
| 72 | |
kkinnunen | ccdaa04 | 2014-08-20 01:36:23 -0700 | [diff] [blame] | 73 | void GrGLPathRendering::resetContext() { |
| 74 | fHWProjectionMatrixState.invalidate(); |
| 75 | // we don't use the model view matrix. |
jvanverth | 5053063 | 2015-04-27 10:36:27 -0700 | [diff] [blame] | 76 | GL_CALL(MatrixLoadIdentity(GR_GL_PATH_MODELVIEW)); |
kkinnunen | ccdaa04 | 2014-08-20 01:36:23 -0700 | [diff] [blame] | 77 | |
kkinnunen | ccdaa04 | 2014-08-20 01:36:23 -0700 | [diff] [blame] | 78 | fHWPathStencilSettings.invalidate(); |
| 79 | } |
| 80 | |
Robert Phillips | 67d52cf | 2017-06-05 13:38:13 -0400 | [diff] [blame] | 81 | sk_sp<GrPath> GrGLPathRendering::createPath(const SkPath& inPath, const GrStyle& style) { |
| 82 | return sk_make_sp<GrGLPath>(this->gpu(), inPath, style); |
kkinnunen | ccdaa04 | 2014-08-20 01:36:23 -0700 | [diff] [blame] | 83 | } |
| 84 | |
kkinnunen | cabe20c | 2015-06-01 01:37:26 -0700 | [diff] [blame] | 85 | void GrGLPathRendering::onStencilPath(const StencilPathArgs& args, const GrPath* path) { |
| 86 | GrGLGpu* gpu = this->gpu(); |
| 87 | SkASSERT(gpu->caps()->shaderCaps()->pathRenderingSupport()); |
| 88 | gpu->flushColorWrite(false); |
kkinnunen | cabe20c | 2015-06-01 01:37:26 -0700 | [diff] [blame] | 89 | |
Brian Salomon | fd98c2c | 2018-07-31 17:25:29 -0400 | [diff] [blame] | 90 | GrGLRenderTarget* rt = static_cast<GrGLRenderTarget*>(args.fProxy->peekRenderTarget()); |
Brian Salomon | 9f2b86c | 2019-10-22 10:37:46 -0400 | [diff] [blame] | 91 | SkISize dimensions = rt->dimensions(); |
Greg Daniel | b8d84f8 | 2020-02-13 14:25:00 -0500 | [diff] [blame] | 92 | this->setProjectionMatrix(*args.fViewMatrix, dimensions, args.fOrigin); |
| 93 | gpu->flushScissor(*args.fScissor, rt->width(), rt->height(), args.fOrigin); |
Chris Dalton | 4c56b03 | 2019-03-04 12:28:42 -0700 | [diff] [blame] | 94 | gpu->flushHWAAState(rt, args.fUseHWAA); |
Chris Dalton | c8ece3d | 2018-07-30 15:03:45 -0600 | [diff] [blame] | 95 | gpu->flushRenderTarget(rt); |
kkinnunen | cabe20c | 2015-06-01 01:37:26 -0700 | [diff] [blame] | 96 | |
kkinnunen | 50b58e6 | 2015-05-18 23:02:07 -0700 | [diff] [blame] | 97 | const GrGLPath* glPath = static_cast<const GrGLPath*>(path); |
kkinnunen | 5b65357 | 2014-08-20 04:13:27 -0700 | [diff] [blame] | 98 | |
kkinnunen | cabe20c | 2015-06-01 01:37:26 -0700 | [diff] [blame] | 99 | this->flushPathStencilSettings(*args.fStencil); |
kkinnunen | 5b65357 | 2014-08-20 04:13:27 -0700 | [diff] [blame] | 100 | |
Chris Dalton | 67d43fe | 2019-11-05 23:01:21 -0700 | [diff] [blame] | 101 | GrGLenum fillMode = gr_stencil_op_to_gl_path_rendering_fill_mode( |
| 102 | fHWPathStencilSettings.singleSidedFace().fPassOp); |
| 103 | GrGLint writeMask = fHWPathStencilSettings.singleSidedFace().fWriteMask; |
joshualitt | 92e496f | 2014-10-31 13:56:50 -0700 | [diff] [blame] | 104 | |
kkinnunen | 50b58e6 | 2015-05-18 23:02:07 -0700 | [diff] [blame] | 105 | if (glPath->shouldFill()) { |
| 106 | GL_CALL(StencilFillPath(glPath->pathID(), fillMode, writeMask)); |
joshualitt | 92e496f | 2014-10-31 13:56:50 -0700 | [diff] [blame] | 107 | } |
kkinnunen | 50b58e6 | 2015-05-18 23:02:07 -0700 | [diff] [blame] | 108 | if (glPath->shouldStroke()) { |
| 109 | GL_CALL(StencilStrokePath(glPath->pathID(), 0xffff, writeMask)); |
joshualitt | 92e496f | 2014-10-31 13:56:50 -0700 | [diff] [blame] | 110 | } |
| 111 | } |
| 112 | |
Chris Dalton | 304e14d | 2020-03-17 14:29:06 -0600 | [diff] [blame] | 113 | void GrGLPathRendering::onDrawPath(const GrStencilSettings& stencilPassSettings, |
stephana | 1dc1721 | 2016-04-25 07:01:22 -0700 | [diff] [blame] | 114 | const GrPath* path) { |
stephana | 1dc1721 | 2016-04-25 07:01:22 -0700 | [diff] [blame] | 115 | const GrGLPath* glPath = static_cast<const GrGLPath*>(path); |
| 116 | |
cdalton | 193d9cf | 2016-05-12 11:52:02 -0700 | [diff] [blame] | 117 | this->flushPathStencilSettings(stencilPassSettings); |
stephana | 1dc1721 | 2016-04-25 07:01:22 -0700 | [diff] [blame] | 118 | |
Chris Dalton | 67d43fe | 2019-11-05 23:01:21 -0700 | [diff] [blame] | 119 | GrGLenum fillMode = gr_stencil_op_to_gl_path_rendering_fill_mode( |
| 120 | fHWPathStencilSettings.singleSidedFace().fPassOp); |
| 121 | GrGLint writeMask = fHWPathStencilSettings.singleSidedFace().fWriteMask; |
stephana | 1dc1721 | 2016-04-25 07:01:22 -0700 | [diff] [blame] | 122 | |
| 123 | if (glPath->shouldStroke()) { |
| 124 | if (glPath->shouldFill()) { |
| 125 | GL_CALL(StencilFillPath(glPath->pathID(), fillMode, writeMask)); |
| 126 | } |
| 127 | GL_CALL(StencilThenCoverStrokePath(glPath->pathID(), 0xffff, writeMask, |
| 128 | GR_GL_BOUNDING_BOX)); |
| 129 | } else { |
| 130 | GL_CALL(StencilThenCoverFillPath(glPath->pathID(), fillMode, writeMask, |
| 131 | GR_GL_BOUNDING_BOX)); |
| 132 | } |
| 133 | } |
| 134 | |
kkinnunen | 5b65357 | 2014-08-20 04:13:27 -0700 | [diff] [blame] | 135 | void GrGLPathRendering::setProgramPathFragmentInputTransform(GrGLuint program, GrGLint location, |
| 136 | GrGLenum genMode, GrGLint components, |
| 137 | const SkMatrix& matrix) { |
egdaniel | 018fb62 | 2015-10-28 07:26:40 -0700 | [diff] [blame] | 138 | float coefficients[3 * 3]; |
kkinnunen | 5b65357 | 2014-08-20 04:13:27 -0700 | [diff] [blame] | 139 | SkASSERT(components >= 1 && components <= 3); |
kkinnunen | ccdaa04 | 2014-08-20 01:36:23 -0700 | [diff] [blame] | 140 | |
kkinnunen | 5b65357 | 2014-08-20 04:13:27 -0700 | [diff] [blame] | 141 | coefficients[0] = SkScalarToFloat(matrix[SkMatrix::kMScaleX]); |
| 142 | coefficients[1] = SkScalarToFloat(matrix[SkMatrix::kMSkewX]); |
| 143 | coefficients[2] = SkScalarToFloat(matrix[SkMatrix::kMTransX]); |
kkinnunen | ccdaa04 | 2014-08-20 01:36:23 -0700 | [diff] [blame] | 144 | |
kkinnunen | 5b65357 | 2014-08-20 04:13:27 -0700 | [diff] [blame] | 145 | if (components >= 2) { |
| 146 | coefficients[3] = SkScalarToFloat(matrix[SkMatrix::kMSkewY]); |
| 147 | coefficients[4] = SkScalarToFloat(matrix[SkMatrix::kMScaleY]); |
| 148 | coefficients[5] = SkScalarToFloat(matrix[SkMatrix::kMTransY]); |
kkinnunen | ccdaa04 | 2014-08-20 01:36:23 -0700 | [diff] [blame] | 149 | } |
kkinnunen | ccdaa04 | 2014-08-20 01:36:23 -0700 | [diff] [blame] | 150 | |
kkinnunen | 5b65357 | 2014-08-20 04:13:27 -0700 | [diff] [blame] | 151 | if (components >= 3) { |
| 152 | coefficients[6] = SkScalarToFloat(matrix[SkMatrix::kMPersp0]); |
| 153 | coefficients[7] = SkScalarToFloat(matrix[SkMatrix::kMPersp1]); |
| 154 | coefficients[8] = SkScalarToFloat(matrix[SkMatrix::kMPersp2]); |
kkinnunen | ccdaa04 | 2014-08-20 01:36:23 -0700 | [diff] [blame] | 155 | } |
kkinnunen | 68c63b3 | 2016-03-04 00:12:33 -0800 | [diff] [blame] | 156 | SkDEBUGCODE(verify_floats(coefficients, components * 3)); |
kkinnunen | ccdaa04 | 2014-08-20 01:36:23 -0700 | [diff] [blame] | 157 | |
kkinnunen | 5b65357 | 2014-08-20 04:13:27 -0700 | [diff] [blame] | 158 | GL_CALL(ProgramPathFragmentInputGen(program, location, genMode, components, coefficients)); |
kkinnunen | ccdaa04 | 2014-08-20 01:36:23 -0700 | [diff] [blame] | 159 | } |
| 160 | |
| 161 | void GrGLPathRendering::setProjectionMatrix(const SkMatrix& matrix, |
joshualitt | ee2af95 | 2014-12-30 09:04:15 -0800 | [diff] [blame] | 162 | const SkISize& renderTargetSize, |
| 163 | GrSurfaceOrigin renderTargetOrigin) { |
kkinnunen | ccdaa04 | 2014-08-20 01:36:23 -0700 | [diff] [blame] | 164 | |
kkinnunen | cabe20c | 2015-06-01 01:37:26 -0700 | [diff] [blame] | 165 | SkASSERT(this->gpu()->glCaps().shaderCaps()->pathRenderingSupport()); |
kkinnunen | ccdaa04 | 2014-08-20 01:36:23 -0700 | [diff] [blame] | 166 | |
| 167 | if (renderTargetOrigin == fHWProjectionMatrixState.fRenderTargetOrigin && |
| 168 | renderTargetSize == fHWProjectionMatrixState.fRenderTargetSize && |
Mike Reed | 2c38315 | 2019-12-18 16:47:47 -0500 | [diff] [blame] | 169 | SkMatrixPriv::CheapEqual(matrix, fHWProjectionMatrixState.fViewMatrix)) { |
kkinnunen | ccdaa04 | 2014-08-20 01:36:23 -0700 | [diff] [blame] | 170 | return; |
| 171 | } |
| 172 | |
| 173 | fHWProjectionMatrixState.fViewMatrix = matrix; |
| 174 | fHWProjectionMatrixState.fRenderTargetSize = renderTargetSize; |
| 175 | fHWProjectionMatrixState.fRenderTargetOrigin = renderTargetOrigin; |
| 176 | |
egdaniel | 018fb62 | 2015-10-28 07:26:40 -0700 | [diff] [blame] | 177 | float glMatrix[4 * 4]; |
Brian Osman | 0b1e5fc | 2020-03-18 11:27:10 -0400 | [diff] [blame] | 178 | fHWProjectionMatrixState.getRTAdjustedGLMatrix(glMatrix); |
kkinnunen | 68c63b3 | 2016-03-04 00:12:33 -0800 | [diff] [blame] | 179 | SkDEBUGCODE(verify_floats(glMatrix, SK_ARRAY_COUNT(glMatrix))); |
jvanverth | 5053063 | 2015-04-27 10:36:27 -0700 | [diff] [blame] | 180 | GL_CALL(MatrixLoadf(GR_GL_PATH_PROJECTION, glMatrix)); |
kkinnunen | ccdaa04 | 2014-08-20 01:36:23 -0700 | [diff] [blame] | 181 | } |
| 182 | |
cdalton | c7103a1 | 2014-08-11 14:05:05 -0700 | [diff] [blame] | 183 | GrGLuint GrGLPathRendering::genPaths(GrGLsizei range) { |
kkinnunen | 702501d | 2016-01-13 23:36:45 -0800 | [diff] [blame] | 184 | SkASSERT(range > 0); |
| 185 | GrGLuint firstID; |
| 186 | if (fPreallocatedPathCount >= range) { |
| 187 | firstID = fFirstPreallocatedPathID; |
| 188 | fPreallocatedPathCount -= range; |
| 189 | fFirstPreallocatedPathID += range; |
| 190 | return firstID; |
| 191 | } |
| 192 | // Allocate range + the amount to fill up preallocation amount. If succeed, either join with |
| 193 | // the existing preallocation range or delete the existing and use the new (potentially partial) |
| 194 | // preallocation range. |
| 195 | GrGLsizei allocAmount = range + (kPathIDPreallocationAmount - fPreallocatedPathCount); |
| 196 | if (allocAmount >= range) { |
| 197 | GL_CALL_RET(firstID, GenPaths(allocAmount)); |
| 198 | |
| 199 | if (firstID != 0) { |
| 200 | if (fPreallocatedPathCount > 0 && |
| 201 | firstID == fFirstPreallocatedPathID + fPreallocatedPathCount) { |
| 202 | firstID = fFirstPreallocatedPathID; |
| 203 | fPreallocatedPathCount += allocAmount - range; |
| 204 | fFirstPreallocatedPathID += range; |
| 205 | return firstID; |
| 206 | } |
| 207 | |
| 208 | if (allocAmount > range) { |
| 209 | if (fPreallocatedPathCount > 0) { |
| 210 | this->deletePaths(fFirstPreallocatedPathID, fPreallocatedPathCount); |
| 211 | } |
| 212 | fFirstPreallocatedPathID = firstID + range; |
| 213 | fPreallocatedPathCount = allocAmount - range; |
| 214 | } |
| 215 | // Special case: if allocAmount == range, we have full preallocated range. |
| 216 | return firstID; |
| 217 | } |
| 218 | } |
| 219 | // Failed to allocate with preallocation. Remove existing preallocation and try to allocate just |
| 220 | // the range. |
| 221 | if (fPreallocatedPathCount > 0) { |
| 222 | this->deletePaths(fFirstPreallocatedPathID, fPreallocatedPathCount); |
| 223 | fPreallocatedPathCount = 0; |
cdalton | c7103a1 | 2014-08-11 14:05:05 -0700 | [diff] [blame] | 224 | } |
| 225 | |
kkinnunen | 702501d | 2016-01-13 23:36:45 -0800 | [diff] [blame] | 226 | GL_CALL_RET(firstID, GenPaths(range)); |
| 227 | if (firstID == 0) { |
| 228 | SkDebugf("Warning: Failed to allocate path\n"); |
cdalton | c7103a1 | 2014-08-11 14:05:05 -0700 | [diff] [blame] | 229 | } |
kkinnunen | 702501d | 2016-01-13 23:36:45 -0800 | [diff] [blame] | 230 | return firstID; |
cdalton | c7103a1 | 2014-08-11 14:05:05 -0700 | [diff] [blame] | 231 | } |
| 232 | |
kkinnunen | 5b65357 | 2014-08-20 04:13:27 -0700 | [diff] [blame] | 233 | void GrGLPathRendering::deletePaths(GrGLuint path, GrGLsizei range) { |
kkinnunen | 702501d | 2016-01-13 23:36:45 -0800 | [diff] [blame] | 234 | GL_CALL(DeletePaths(path, range)); |
cdalton | c7103a1 | 2014-08-11 14:05:05 -0700 | [diff] [blame] | 235 | } |
| 236 | |
joshualitt | 92e496f | 2014-10-31 13:56:50 -0700 | [diff] [blame] | 237 | void GrGLPathRendering::flushPathStencilSettings(const GrStencilSettings& stencilSettings) { |
Chris Dalton | 71713f6 | 2019-04-18 12:41:03 -0600 | [diff] [blame] | 238 | SkASSERT(!stencilSettings.isTwoSided()); |
joshualitt | 92e496f | 2014-10-31 13:56:50 -0700 | [diff] [blame] | 239 | if (fHWPathStencilSettings != stencilSettings) { |
kkinnunen | 1517f93 | 2016-01-25 06:07:26 -0800 | [diff] [blame] | 240 | SkASSERT(stencilSettings.isValid()); |
kkinnunen | 5b65357 | 2014-08-20 04:13:27 -0700 | [diff] [blame] | 241 | // Just the func, ref, and mask is set here. The op and write mask are params to the call |
| 242 | // that draws the path to the SB (glStencilFillPath) |
Chris Dalton | 67d43fe | 2019-11-05 23:01:21 -0700 | [diff] [blame] | 243 | uint16_t ref = stencilSettings.singleSidedFace().fRef; |
| 244 | GrStencilTest test = stencilSettings.singleSidedFace().fTest; |
| 245 | uint16_t testMask = stencilSettings.singleSidedFace().fTestMask; |
kkinnunen | 5b65357 | 2014-08-20 04:13:27 -0700 | [diff] [blame] | 246 | |
kkinnunen | 1517f93 | 2016-01-25 06:07:26 -0800 | [diff] [blame] | 247 | if (!fHWPathStencilSettings.isValid() || |
Chris Dalton | 67d43fe | 2019-11-05 23:01:21 -0700 | [diff] [blame] | 248 | ref != fHWPathStencilSettings.singleSidedFace().fRef || |
| 249 | test != fHWPathStencilSettings.singleSidedFace().fTest || |
| 250 | testMask != fHWPathStencilSettings.singleSidedFace().fTestMask) { |
cdalton | 93a379b | 2016-05-11 13:58:08 -0700 | [diff] [blame] | 251 | GL_CALL(PathStencilFunc(GrToGLStencilFunc(test), ref, testMask)); |
kkinnunen | 1517f93 | 2016-01-25 06:07:26 -0800 | [diff] [blame] | 252 | } |
joshualitt | 92e496f | 2014-10-31 13:56:50 -0700 | [diff] [blame] | 253 | fHWPathStencilSettings = stencilSettings; |
kkinnunen | 5b65357 | 2014-08-20 04:13:27 -0700 | [diff] [blame] | 254 | } |
cdalton | c7103a1 | 2014-08-11 14:05:05 -0700 | [diff] [blame] | 255 | } |
| 256 | |
kkinnunen | cabe20c | 2015-06-01 01:37:26 -0700 | [diff] [blame] | 257 | inline GrGLGpu* GrGLPathRendering::gpu() { |
| 258 | return static_cast<GrGLGpu*>(fGpu); |
| 259 | } |