blob: 19c90f8e74c4a8c729c11e0e95acc4d71b3382c5 [file] [log] [blame]
joshualitta751c972015-11-20 13:37:32 -08001/*
2 * Copyright 2015 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 Kleinc0bd9f92019-04-23 12:05:21 -05008#include "src/gpu/ops/GrAtlasTextOp.h"
Robert Phillipse4fda6c2018-02-21 12:10:41 -05009
Mike Kleinc0bd9f92019-04-23 12:05:21 -050010#include "include/core/SkPoint3.h"
11#include "include/private/GrRecordingContext.h"
12#include "src/core/SkMathPriv.h"
13#include "src/core/SkMatrixPriv.h"
14#include "src/core/SkStrikeCache.h"
15#include "src/gpu/GrCaps.h"
16#include "src/gpu/GrMemoryPool.h"
17#include "src/gpu/GrOpFlushState.h"
18#include "src/gpu/GrRecordingContextPriv.h"
19#include "src/gpu/GrResourceProvider.h"
20#include "src/gpu/effects/GrBitmapTextGeoProc.h"
21#include "src/gpu/effects/GrDistanceFieldGeoProc.h"
Robert Phillips3968fcb2019-12-05 16:40:31 -050022#include "src/gpu/ops/GrSimpleMeshDrawOpHelper.h"
Mike Kleinc0bd9f92019-04-23 12:05:21 -050023#include "src/gpu/text/GrAtlasManager.h"
24#include "src/gpu/text/GrStrikeCache.h"
joshualitta751c972015-11-20 13:37:32 -080025
joshualitt60ce86d2015-11-23 13:08:22 -080026///////////////////////////////////////////////////////////////////////////////////////////////////
27
Robert Phillipsb97da532019-02-12 15:24:12 -050028std::unique_ptr<GrAtlasTextOp> GrAtlasTextOp::MakeBitmap(GrRecordingContext* context,
Robert Phillips7c525e62018-06-12 10:11:12 -040029 GrPaint&& paint,
30 GrMaskFormat maskFormat,
31 int glyphCount,
32 bool needsTransform) {
Robert Phillips9da87e02019-02-04 13:26:26 -050033 GrOpMemoryPool* pool = context->priv().opMemoryPool();
Robert Phillipsc994a932018-06-19 13:09:54 -040034
35 std::unique_ptr<GrAtlasTextOp> op = pool->allocate<GrAtlasTextOp>(std::move(paint));
Robert Phillips7c525e62018-06-12 10:11:12 -040036
37 switch (maskFormat) {
38 case kA8_GrMaskFormat:
39 op->fMaskType = kGrayscaleCoverageMask_MaskType;
40 break;
41 case kA565_GrMaskFormat:
42 op->fMaskType = kLCDCoverageMask_MaskType;
43 break;
44 case kARGB_GrMaskFormat:
45 op->fMaskType = kColorBitmapMask_MaskType;
46 break;
47 }
48 op->fNumGlyphs = glyphCount;
49 op->fGeoCount = 1;
50 op->fLuminanceColor = 0;
51 op->fNeedsGlyphTransform = needsTransform;
52 return op;
53 }
54
55std::unique_ptr<GrAtlasTextOp> GrAtlasTextOp::MakeDistanceField(
Robert Phillipsb97da532019-02-12 15:24:12 -050056 GrRecordingContext* context,
Robert Phillips7c525e62018-06-12 10:11:12 -040057 GrPaint&& paint,
58 int glyphCount,
59 const GrDistanceFieldAdjustTable* distanceAdjustTable,
60 bool useGammaCorrectDistanceTable,
61 SkColor luminanceColor,
62 const SkSurfaceProps& props,
63 bool isAntiAliased,
64 bool useLCD) {
Robert Phillips9da87e02019-02-04 13:26:26 -050065 GrOpMemoryPool* pool = context->priv().opMemoryPool();
Robert Phillipsc994a932018-06-19 13:09:54 -040066
67 std::unique_ptr<GrAtlasTextOp> op = pool->allocate<GrAtlasTextOp>(std::move(paint));
Robert Phillips7c525e62018-06-12 10:11:12 -040068
69 bool isBGR = SkPixelGeometryIsBGR(props.pixelGeometry());
70 bool isLCD = useLCD && SkPixelGeometryIsH(props.pixelGeometry());
71 op->fMaskType = !isAntiAliased ? kAliasedDistanceField_MaskType
72 : isLCD ? (isBGR ? kLCDBGRDistanceField_MaskType
73 : kLCDDistanceField_MaskType)
74 : kGrayscaleDistanceField_MaskType;
75 op->fDistanceAdjustTable.reset(SkRef(distanceAdjustTable));
76 op->fUseGammaCorrectDistanceTable = useGammaCorrectDistanceTable;
77 op->fLuminanceColor = luminanceColor;
78 op->fNumGlyphs = glyphCount;
79 op->fGeoCount = 1;
80 return op;
81 }
82
joshualitta751c972015-11-20 13:37:32 -080083static const int kDistanceAdjustLumShift = 5;
84
Brian Salomon5c6ac642017-12-19 11:09:32 -050085void GrAtlasTextOp::init() {
86 const Geometry& geo = fGeoData[0];
Brian Salomon5c6ac642017-12-19 11:09:32 -050087 if (this->usesDistanceFields()) {
88 bool isLCD = this->isLCD();
89
Herb Derby1c5be7b2019-12-13 12:03:06 -050090 const SkMatrix& drawMatrix = geo.fDrawMatrix;
Brian Salomon5c6ac642017-12-19 11:09:32 -050091
Herb Derby1c5be7b2019-12-13 12:03:06 -050092 fDFGPFlags = drawMatrix.isSimilarity() ? kSimilarity_DistanceFieldEffectFlag : 0;
93 fDFGPFlags |= drawMatrix.isScaleTranslate() ? kScaleOnly_DistanceFieldEffectFlag : 0;
94 fDFGPFlags |= drawMatrix.hasPerspective() ? kPerspective_DistanceFieldEffectFlag : 0;
Brian Salomon5c6ac642017-12-19 11:09:32 -050095 fDFGPFlags |= fUseGammaCorrectDistanceTable ? kGammaCorrect_DistanceFieldEffectFlag : 0;
96 fDFGPFlags |= (kAliasedDistanceField_MaskType == fMaskType)
97 ? kAliased_DistanceFieldEffectFlag
98 : 0;
99
100 if (isLCD) {
101 fDFGPFlags |= kUseLCD_DistanceFieldEffectFlag;
102 fDFGPFlags |=
103 (kLCDBGRDistanceField_MaskType == fMaskType) ? kBGR_DistanceFieldEffectFlag : 0;
104 }
Jim Van Verthb515ae72018-05-23 16:44:55 -0400105
106 fNeedsGlyphTransform = true;
Brian Salomon5c6ac642017-12-19 11:09:32 -0500107 }
Jim Van Verth70276912018-06-01 13:46:46 -0400108
109 SkRect bounds;
Herb Derby5bf5b042019-12-12 16:37:03 -0500110 geo.fBlob->computeSubRunBounds(
111 &bounds, *geo.fSubRunPtr, geo.fDrawMatrix, geo.fDrawOrigin, fNeedsGlyphTransform);
Jim Van Verth70276912018-06-01 13:46:46 -0400112 // We don't have tight bounds on the glyph paths in device space. For the purposes of bounds
113 // we treat this as a set of non-AA rects rendered with a texture.
Greg Daniel5faf4742019-10-01 15:14:44 -0400114 this->setBounds(bounds, HasAABloat::kNo, IsHairline::kNo);
Brian Salomon5c6ac642017-12-19 11:09:32 -0500115}
116
Chris Dalton1706cbf2019-05-21 19:35:29 -0600117void GrAtlasTextOp::visitProxies(const VisitProxyFunc& func) const {
Robert Phillipse4fda6c2018-02-21 12:10:41 -0500118 fProcessors.visitProxies(func);
Robert Phillipse4fda6c2018-02-21 12:10:41 -0500119}
120
Brian Osman9a390ac2018-11-12 09:47:48 -0500121#ifdef SK_DEBUG
Brian Salomon344ec422016-12-15 10:58:41 -0500122SkString GrAtlasTextOp::dumpInfo() const {
joshualitta751c972015-11-20 13:37:32 -0800123 SkString str;
124
125 for (int i = 0; i < fGeoCount; ++i) {
Herb Derby1b8dcd12019-11-15 15:21:15 -0500126 str.appendf("%d: Color: 0x%08x Trans: %.2f,%.2f\n",
joshualitta751c972015-11-20 13:37:32 -0800127 i,
Brian Osmancf860852018-10-31 14:04:39 -0400128 fGeoData[i].fColor.toBytes_RGBA(),
Herb Derby5bf5b042019-12-12 16:37:03 -0500129 fGeoData[i].fDrawOrigin.x(),
130 fGeoData[i].fDrawOrigin.y());
joshualitta751c972015-11-20 13:37:32 -0800131 }
132
Brian Salomon44acb5b2017-07-18 19:59:24 -0400133 str += fProcessors.dumpProcessors();
134 str += INHERITED::dumpInfo();
joshualitta751c972015-11-20 13:37:32 -0800135 return str;
136}
Brian Osman9a390ac2018-11-12 09:47:48 -0500137#endif
joshualitta751c972015-11-20 13:37:32 -0800138
Brian Salomon44acb5b2017-07-18 19:59:24 -0400139GrDrawOp::FixedFunctionFlags GrAtlasTextOp::fixedFunctionFlags() const {
140 return FixedFunctionFlags::kNone;
141}
142
Chris Dalton6ce447a2019-06-23 18:07:38 -0600143GrProcessorSet::Analysis GrAtlasTextOp::finalize(
144 const GrCaps& caps, const GrAppliedClip* clip, bool hasMixedSampledCoverage,
145 GrClampType clampType) {
Brian Salomon44acb5b2017-07-18 19:59:24 -0400146 GrProcessorAnalysisCoverage coverage;
147 GrProcessorAnalysisColor color;
joshualitta751c972015-11-20 13:37:32 -0800148 if (kColorBitmapMask_MaskType == fMaskType) {
Brian Salomon44acb5b2017-07-18 19:59:24 -0400149 color.setToUnknown();
joshualitta751c972015-11-20 13:37:32 -0800150 } else {
Brian Osman09068252018-01-03 09:57:29 -0500151 color.setToConstant(this->color());
joshualitta751c972015-11-20 13:37:32 -0800152 }
joshualitta751c972015-11-20 13:37:32 -0800153 switch (fMaskType) {
joshualitta751c972015-11-20 13:37:32 -0800154 case kGrayscaleCoverageMask_MaskType:
Jim Van Verth90e89b32017-07-06 16:36:55 -0400155 case kAliasedDistanceField_MaskType:
156 case kGrayscaleDistanceField_MaskType:
Brian Salomon44acb5b2017-07-18 19:59:24 -0400157 coverage = GrProcessorAnalysisCoverage::kSingleChannel;
joshualitta751c972015-11-20 13:37:32 -0800158 break;
159 case kLCDCoverageMask_MaskType:
160 case kLCDDistanceField_MaskType:
Jim Van Verth90e89b32017-07-06 16:36:55 -0400161 case kLCDBGRDistanceField_MaskType:
Brian Salomon44acb5b2017-07-18 19:59:24 -0400162 coverage = GrProcessorAnalysisCoverage::kLCD;
joshualitta751c972015-11-20 13:37:32 -0800163 break;
164 case kColorBitmapMask_MaskType:
Brian Salomon44acb5b2017-07-18 19:59:24 -0400165 coverage = GrProcessorAnalysisCoverage::kNone;
Brian Salomonc0b642c2017-03-27 13:09:36 -0400166 break;
joshualitta751c972015-11-20 13:37:32 -0800167 }
Chris Daltonb8fff0d2019-03-05 10:11:58 -0700168 auto analysis = fProcessors.finalize(
Chris Dalton6ce447a2019-06-23 18:07:38 -0600169 color, coverage, clip, &GrUserStencilSettings::kUnused, hasMixedSampledCoverage, caps,
170 clampType, &fGeoData[0].fColor);
Brian Salomon44acb5b2017-07-18 19:59:24 -0400171 fUsesLocalCoords = analysis.usesLocalCoords();
Chris Dalton4b62aed2019-01-15 11:53:00 -0700172 return analysis;
joshualitta751c972015-11-20 13:37:32 -0800173}
174
Brian Salomon18923f92017-11-06 16:26:02 -0500175static void clip_quads(const SkIRect& clipRect, char* currVertex, const char* blobVertices,
Jim Van Verth58c3cce2017-10-19 15:50:24 -0400176 size_t vertexStride, int glyphCount) {
177 for (int i = 0; i < glyphCount; ++i) {
Brian Salomon18923f92017-11-06 16:26:02 -0500178 const SkPoint* blobPositionLT = reinterpret_cast<const SkPoint*>(blobVertices);
179 const SkPoint* blobPositionRB =
180 reinterpret_cast<const SkPoint*>(blobVertices + 3 * vertexStride);
Jim Van Verth58c3cce2017-10-19 15:50:24 -0400181
Jim Van Verth328a33f2017-10-20 12:14:22 -0400182 // positions for bitmap glyphs are pixel boundary aligned
Brian Osman7ca90d22017-11-10 15:31:27 -0500183 SkIRect positionRect = SkIRect::MakeLTRB(SkScalarRoundToInt(blobPositionLT->fX),
184 SkScalarRoundToInt(blobPositionLT->fY),
185 SkScalarRoundToInt(blobPositionRB->fX),
186 SkScalarRoundToInt(blobPositionRB->fY));
Jim Van Verth58c3cce2017-10-19 15:50:24 -0400187 if (clipRect.contains(positionRect)) {
188 memcpy(currVertex, blobVertices, 4 * vertexStride);
189 currVertex += 4 * vertexStride;
190 } else {
191 // Pull out some more data that we'll need.
192 // In the LCD case the color will be garbage, but we'll overwrite it with the texcoords
193 // and it avoids a lot of conditionals.
Brian Salomon18923f92017-11-06 16:26:02 -0500194 auto color = *reinterpret_cast<const SkColor*>(blobVertices + sizeof(SkPoint));
Jim Van Verth2f2c77a2020-01-24 15:48:23 +0000195 size_t coordOffset = vertexStride - 2*sizeof(uint16_t);
196 auto* blobCoordsLT = reinterpret_cast<const uint16_t*>(blobVertices + coordOffset);
197 auto* blobCoordsRB = reinterpret_cast<const uint16_t*>(blobVertices + 3 * vertexStride +
Brian Salomon18923f92017-11-06 16:26:02 -0500198 coordOffset);
Jim Van Verth328a33f2017-10-20 12:14:22 -0400199 // Pull out the texel coordinates and texture index bits
Jim Van Verthfb395102020-02-03 10:11:19 -0500200 uint16_t coordsRectL = blobCoordsLT[0];
201 uint16_t coordsRectT = blobCoordsLT[1];
202 uint16_t coordsRectR = blobCoordsRB[0];
203 uint16_t coordsRectB = blobCoordsRB[1];
204 int index0, index1;
205 std::tie(coordsRectL, coordsRectT, index0) =
206 GrDrawOpAtlas::UnpackIndexFromTexCoords(coordsRectL, coordsRectT);
207 std::tie(coordsRectR, coordsRectB, index1) =
208 GrDrawOpAtlas::UnpackIndexFromTexCoords(coordsRectR, coordsRectB);
209 SkASSERT(index0 == index1);
Jim Van Verth58c3cce2017-10-19 15:50:24 -0400210
Jim Van Verth328a33f2017-10-20 12:14:22 -0400211 int positionRectWidth = positionRect.width();
212 int positionRectHeight = positionRect.height();
213 SkASSERT(positionRectWidth == (coordsRectR - coordsRectL));
214 SkASSERT(positionRectHeight == (coordsRectB - coordsRectT));
Jim Van Verth58c3cce2017-10-19 15:50:24 -0400215
216 // Clip position and texCoords to the clipRect
Jim Van Verth328a33f2017-10-20 12:14:22 -0400217 unsigned int delta;
218 delta = SkTMin(SkTMax(clipRect.fLeft - positionRect.fLeft, 0), positionRectWidth);
219 coordsRectL += delta;
220 positionRect.fLeft += delta;
Jim Van Verth58c3cce2017-10-19 15:50:24 -0400221
Jim Van Verth328a33f2017-10-20 12:14:22 -0400222 delta = SkTMin(SkTMax(clipRect.fTop - positionRect.fTop, 0), positionRectHeight);
223 coordsRectT += delta;
224 positionRect.fTop += delta;
225
226 delta = SkTMin(SkTMax(positionRect.fRight - clipRect.fRight, 0), positionRectWidth);
227 coordsRectR -= delta;
228 positionRect.fRight -= delta;
229
230 delta = SkTMin(SkTMax(positionRect.fBottom - clipRect.fBottom, 0), positionRectHeight);
231 coordsRectB -= delta;
232 positionRect.fBottom -= delta;
233
234 // Repack texel coordinates and index
Jim Van Verthfb395102020-02-03 10:11:19 -0500235 std::tie(coordsRectL, coordsRectT) =
236 GrDrawOpAtlas::PackIndexInTexCoords(coordsRectL, coordsRectT, index0);
237 std::tie(coordsRectR, coordsRectB) =
238 GrDrawOpAtlas::PackIndexInTexCoords(coordsRectR, coordsRectB, index1);
Jim Van Verth328a33f2017-10-20 12:14:22 -0400239
240 // Set new positions and coords
Jim Van Verth58c3cce2017-10-19 15:50:24 -0400241 SkPoint* currPosition = reinterpret_cast<SkPoint*>(currVertex);
242 currPosition->fX = positionRect.fLeft;
243 currPosition->fY = positionRect.fTop;
244 *(reinterpret_cast<SkColor*>(currVertex + sizeof(SkPoint))) = color;
Jim Van Verth328a33f2017-10-20 12:14:22 -0400245 uint16_t* currCoords = reinterpret_cast<uint16_t*>(currVertex + coordOffset);
246 currCoords[0] = coordsRectL;
247 currCoords[1] = coordsRectT;
Jim Van Verth58c3cce2017-10-19 15:50:24 -0400248 currVertex += vertexStride;
249
250 currPosition = reinterpret_cast<SkPoint*>(currVertex);
251 currPosition->fX = positionRect.fLeft;
252 currPosition->fY = positionRect.fBottom;
253 *(reinterpret_cast<SkColor*>(currVertex + sizeof(SkPoint))) = color;
Jim Van Verth328a33f2017-10-20 12:14:22 -0400254 currCoords = reinterpret_cast<uint16_t*>(currVertex + coordOffset);
255 currCoords[0] = coordsRectL;
256 currCoords[1] = coordsRectB;
Jim Van Verth58c3cce2017-10-19 15:50:24 -0400257 currVertex += vertexStride;
258
259 currPosition = reinterpret_cast<SkPoint*>(currVertex);
260 currPosition->fX = positionRect.fRight;
261 currPosition->fY = positionRect.fTop;
262 *(reinterpret_cast<SkColor*>(currVertex + sizeof(SkPoint))) = color;
Jim Van Verth328a33f2017-10-20 12:14:22 -0400263 currCoords = reinterpret_cast<uint16_t*>(currVertex + coordOffset);
264 currCoords[0] = coordsRectR;
265 currCoords[1] = coordsRectT;
Jim Van Verth58c3cce2017-10-19 15:50:24 -0400266 currVertex += vertexStride;
267
268 currPosition = reinterpret_cast<SkPoint*>(currVertex);
269 currPosition->fX = positionRect.fRight;
270 currPosition->fY = positionRect.fBottom;
271 *(reinterpret_cast<SkColor*>(currVertex + sizeof(SkPoint))) = color;
Jim Van Verth328a33f2017-10-20 12:14:22 -0400272 currCoords = reinterpret_cast<uint16_t*>(currVertex + coordOffset);
273 currCoords[0] = coordsRectR;
274 currCoords[1] = coordsRectB;
Jim Van Verth58c3cce2017-10-19 15:50:24 -0400275 currVertex += vertexStride;
276 }
277
278 blobVertices += 4 * vertexStride;
279 }
280}
281
Brian Salomon91326c32017-08-09 16:02:19 -0400282void GrAtlasTextOp::onPrepareDraws(Target* target) {
Robert Phillips4bc70112018-03-01 10:24:02 -0500283 auto resourceProvider = target->resourceProvider();
284
joshualitta751c972015-11-20 13:37:32 -0800285 // if we have RGB, then we won't have any SkShaders so no need to use a localmatrix.
286 // TODO actually only invert if we don't have RGBA
287 SkMatrix localMatrix;
Herb Derby1c5be7b2019-12-13 12:03:06 -0500288 if (this->usesLocalCoords() && !fGeoData[0].fDrawMatrix.invert(&localMatrix)) {
joshualitta751c972015-11-20 13:37:32 -0800289 return;
290 }
291
Robert Phillips5a66efb2018-03-07 15:13:18 -0500292 GrAtlasManager* atlasManager = target->atlasManager();
Mike Klein99e002f2020-01-16 16:45:03 +0000293 GrStrikeCache* glyphCache = target->glyphCache();
294
Jim Van Vertheafa64b2017-09-18 10:05:00 -0400295 GrMaskFormat maskFormat = this->maskFormat();
296
Greg Daniel9715b6c2019-12-10 15:03:10 -0500297 unsigned int numActiveViews;
298 const GrSurfaceProxyView* views = atlasManager->getViews(maskFormat, &numActiveViews);
299 if (!views) {
joshualitta751c972015-11-20 13:37:32 -0800300 SkDebugf("Could not allocate backing texture for atlas\n");
301 return;
302 }
Greg Daniel9715b6c2019-12-10 15:03:10 -0500303 SkASSERT(views[0].proxy());
joshualitta751c972015-11-20 13:37:32 -0800304
Brian Salomon7eae3e02018-08-07 14:02:38 +0000305 static constexpr int kMaxTextures = GrBitmapTextGeoProc::kMaxTextures;
Brian Salomon4dea72a2019-12-18 10:43:10 -0500306 static_assert(GrDistanceFieldA8TextGeoProc::kMaxTextures == kMaxTextures);
307 static_assert(GrDistanceFieldLCDTextGeoProc::kMaxTextures == kMaxTextures);
Brian Salomon7eae3e02018-08-07 14:02:38 +0000308
Chris Dalton07cdcfc92019-02-26 11:13:22 -0700309 auto fixedDynamicState = target->makeFixedDynamicState(kMaxTextures);
Greg Daniel9715b6c2019-12-10 15:03:10 -0500310 for (unsigned i = 0; i < numActiveViews; ++i) {
311 fixedDynamicState->fPrimitiveProcessorTextures[i] = views[i].proxy();
Greg Danielb20d7e52019-09-03 13:54:39 -0400312 // This op does not know its atlas proxies when it is added to a GrOpsTasks, so the proxies
313 // don't get added during the visitProxies call. Thus we add them here.
Greg Daniel9715b6c2019-12-10 15:03:10 -0500314 target->sampledProxyArray()->push_back(views[i].proxy());
Brian Salomon7eae3e02018-08-07 14:02:38 +0000315 }
Brian Salomon49348902018-06-26 09:12:38 -0400316
317 FlushInfo flushInfo;
Chris Dalton07cdcfc92019-02-26 11:13:22 -0700318 flushInfo.fFixedDynamicState = fixedDynamicState;
Brian Salomon49348902018-06-26 09:12:38 -0400319
Herb Derby1c5be7b2019-12-13 12:03:06 -0500320 bool vmPerspective = fGeoData[0].fDrawMatrix.hasPerspective();
joshualittd9d30f72015-12-08 10:47:55 -0800321 if (this->usesDistanceFields()) {
Robert Phillips7cd0bfe2019-11-20 16:08:10 -0500322 flushInfo.fGeometryProcessor = this->setupDfProcessor(target->allocator(),
323 *target->caps().shaderCaps(),
Greg Daniel9715b6c2019-12-10 15:03:10 -0500324 views, numActiveViews);
joshualitta751c972015-11-20 13:37:32 -0800325 } else {
Brian Salomonccb61422020-01-09 10:46:36 -0500326 auto filter = fNeedsGlyphTransform ? GrSamplerState::Filter::kBilerp
327 : GrSamplerState::Filter::kNearest;
328 flushInfo.fGeometryProcessor = GrBitmapTextGeoProc::Make(
329 target->allocator(), *target->caps().shaderCaps(), this->color(), false, views,
330 numActiveViews, filter, maskFormat, localMatrix, vmPerspective);
joshualitta751c972015-11-20 13:37:32 -0800331 }
332
Herb Derby23f29762020-01-10 16:26:14 -0500333 int vertexStride = (int)flushInfo.fGeometryProcessor->vertexStride();
joshualitta751c972015-11-20 13:37:32 -0800334
Brian Salomon43cbd722020-01-03 22:09:12 -0500335 // Ensure we don't request an insanely large contiguous vertex allocation.
Herb Derby23f29762020-01-10 16:26:14 -0500336 static const int kMaxVertexBytes = GrBufferAllocPool::kDefaultBufferSize;
337 const int quadSize = vertexStride * kVerticesPerGlyph;
338 const int maxQuadsPerBuffer = kMaxVertexBytes / quadSize;
339
340 // Where the quad buffer begins and ends relative to totalGlyphsRegened.
341 int quadBufferBegin = 0;
342 int quadBufferEnd = std::min(this->numGlyphs(), maxQuadsPerBuffer);
343
Robert Phillipsee08d522019-10-28 16:34:44 -0400344 flushInfo.fIndexBuffer = resourceProvider->refNonAAQuadIndexBuffer();
Herb Derby23f29762020-01-10 16:26:14 -0500345 void* vertices = target->makeVertexSpace(
346 vertexStride,
347 kVerticesPerGlyph * (quadBufferEnd - quadBufferBegin),
348 &flushInfo.fVertexBuffer,
349 &flushInfo.fVertexOffset);
joshualitta751c972015-11-20 13:37:32 -0800350 if (!vertices || !flushInfo.fVertexBuffer) {
351 SkDebugf("Could not allocate vertices\n");
352 return;
353 }
354
Herb Derby23f29762020-01-10 16:26:14 -0500355 // totalGlyphsRegened is all the glyphs for the op [0, this->numGlyphs()). The subRun glyph and
356 // quad buffer indices are calculated from this.
357 int totalGlyphsRegened = 0;
joshualitta751c972015-11-20 13:37:32 -0800358 for (int i = 0; i < fGeoCount; i++) {
joshualitt144c3c82015-11-30 12:30:13 -0800359 const Geometry& args = fGeoData[i];
Herb Derby23f29762020-01-10 16:26:14 -0500360 auto subRun = args.fSubRunPtr;
361 SkASSERT((int)subRun->vertexStride() == vertexStride);
362
Herb Derby62b12fe2020-01-14 17:57:24 -0500363 subRun->updateVerticesColorIfNeeded(args.fColor.toBytes_RGBA());
364 subRun->translateVerticesIfNeeded(args.fDrawMatrix, args.fDrawOrigin);
365
Brian Osman1be2b7c2018-10-29 16:07:15 -0400366 // TODO4F: Preserve float colors
Herb Derby86240592018-05-24 16:12:31 -0400367 GrTextBlob::VertexRegenerator regenerator(
Mike Klein99e002f2020-01-16 16:45:03 +0000368 resourceProvider, args.fSubRunPtr, target->deferredUploadTarget(), glyphCache,
369 atlasManager);
Herb Derby23f29762020-01-10 16:26:14 -0500370
371 // Where the subRun begins and ends relative to totalGlyphsRegened.
372 int subRunBegin = totalGlyphsRegened;
373 int subRunEnd = subRunBegin + (int)subRun->fGlyphs.size();
374
375 // Draw all the glyphs in the subRun.
376 while (totalGlyphsRegened < subRunEnd) {
377 // drawBegin and drawEnd are indices for the subRun on the
378 // interval [0, subRun->fGlyphs.size()).
379 int drawBegin = totalGlyphsRegened - subRunBegin;
380 // drawEnd is either the end of the subRun or the end of the current quad buffer.
381 int drawEnd = std::min(subRunEnd, quadBufferEnd) - subRunBegin;
382 auto[ok, glyphsRegenerated] = regenerator.regenerate(drawBegin, drawEnd);
383
384 // There was a problem allocating the glyph in the atlas. Bail.
385 if(!ok) { return; }
386
387 // Update all the vertices for glyphsRegenerate glyphs.
388 if (glyphsRegenerated > 0) {
389 int quadBufferIndex = totalGlyphsRegened - quadBufferBegin;
390 int subRunIndex = totalGlyphsRegened - subRunBegin;
391 auto regeneratedQuadBuffer =
392 SkTAddOffset<char>(vertices, subRun->quadOffset(quadBufferIndex));
Brian Salomon43cbd722020-01-03 22:09:12 -0500393 if (args.fClipRect.isEmpty()) {
Herb Derby23f29762020-01-10 16:26:14 -0500394 memcpy(regeneratedQuadBuffer,
395 subRun->quadStart(subRunIndex),
396 glyphsRegenerated * quadSize);
Brian Salomon43cbd722020-01-03 22:09:12 -0500397 } else {
398 SkASSERT(!vmPerspective);
Herb Derby23f29762020-01-10 16:26:14 -0500399 clip_quads(args.fClipRect,
400 regeneratedQuadBuffer,
401 subRun->quadStart(subRunIndex),
402 vertexStride,
403 glyphsRegenerated);
Brian Salomon43cbd722020-01-03 22:09:12 -0500404 }
405 if (fNeedsGlyphTransform && !args.fDrawMatrix.isIdentity()) {
406 // We always do the distance field view matrix transformation after copying
407 // rather than during blob vertex generation time in the blob as handling
408 // successive arbitrary transformations would be complicated and accumulate
409 // error.
410 if (args.fDrawMatrix.hasPerspective()) {
Herb Derby23f29762020-01-10 16:26:14 -0500411 auto* pos = reinterpret_cast<SkPoint3*>(regeneratedQuadBuffer);
412 SkMatrixPriv::MapHomogeneousPointsWithStride(
413 args.fDrawMatrix, pos,
414 vertexStride, pos,
415 vertexStride,
416 glyphsRegenerated * kVerticesPerGlyph);
Brian Salomon43cbd722020-01-03 22:09:12 -0500417 } else {
Herb Derby23f29762020-01-10 16:26:14 -0500418 auto* pos = reinterpret_cast<SkPoint*>(regeneratedQuadBuffer);
Brian Salomon43cbd722020-01-03 22:09:12 -0500419 SkMatrixPriv::MapPointsWithStride(args.fDrawMatrix, pos, vertexStride,
Herb Derby23f29762020-01-10 16:26:14 -0500420 glyphsRegenerated * kVerticesPerGlyph);
Brian Salomon43cbd722020-01-03 22:09:12 -0500421 }
422 }
Robert Phillipsd2e9f762018-03-07 11:54:37 -0500423 }
Herb Derby23f29762020-01-10 16:26:14 -0500424
425 totalGlyphsRegened += glyphsRegenerated;
426 flushInfo.fGlyphsToFlush += glyphsRegenerated;
427
428 // regenerate() has stopped part way through a SubRun. This means that either the atlas
429 // or the quad buffer is full or both. There is a case were the flow through
430 // the loop is strange. If we run out of quad buffer space at the same time the
431 // SubRun ends, then this is not triggered which is the right result for the last
432 // SubRun. But, if this is not the last SubRun, then advance to the next SubRun which
433 // will process no glyphs, and return to this point where the quad buffer will be
434 // expanded.
435 if (totalGlyphsRegened != subRunEnd) {
436 // Flush if not all glyphs drawn because either the quad buffer is full or the
437 // atlas is out of space.
Herb Derby4513cdd2020-01-31 13:28:49 -0500438 this->createDrawForGeneratedGlyphs(target, &flushInfo);
Herb Derby23f29762020-01-10 16:26:14 -0500439 if (totalGlyphsRegened == quadBufferEnd) {
440 // Quad buffer is full. Get more buffer.
441 quadBufferBegin = totalGlyphsRegened;
442 int quadBufferSize =
443 std::min(maxQuadsPerBuffer, this->numGlyphs() - totalGlyphsRegened);
444 quadBufferEnd = quadBufferBegin + quadBufferSize;
445
446 vertices = target->makeVertexSpace(
447 vertexStride,
448 kVerticesPerGlyph * quadBufferSize,
449 &flushInfo.fVertexBuffer,
450 &flushInfo.fVertexOffset);
451 if (!vertices || !flushInfo.fVertexBuffer) {
452 SkDebugf("Could not allocate vertices\n");
453 return;
454 }
455 }
456 }
457 }
Herb Derby5f6f8512020-01-10 12:50:35 -0500458 } // for all geometries
Herb Derby4513cdd2020-01-31 13:28:49 -0500459 this->createDrawForGeneratedGlyphs(target, &flushInfo);
joshualitta751c972015-11-20 13:37:32 -0800460}
461
Chris Dalton07cdcfc92019-02-26 11:13:22 -0700462void GrAtlasTextOp::onExecute(GrOpFlushState* flushState, const SkRect& chainBounds) {
Robert Phillips3968fcb2019-12-05 16:40:31 -0500463 auto pipeline = GrSimpleMeshDrawOpHelper::CreatePipeline(flushState,
464 std::move(fProcessors),
465 GrPipeline::InputFlags::kNone);
466
467 flushState->executeDrawsAndUploadsForMeshDrawOp(this, chainBounds, pipeline);
Chris Dalton07cdcfc92019-02-26 11:13:22 -0700468}
469
Herb Derby4513cdd2020-01-31 13:28:49 -0500470void GrAtlasTextOp::createDrawForGeneratedGlyphs(
471 GrMeshDrawOp::Target* target, FlushInfo* flushInfo) const {
Robert Phillipsd2e9f762018-03-07 11:54:37 -0500472 if (!flushInfo->fGlyphsToFlush) {
473 return;
474 }
475
Robert Phillips5a66efb2018-03-07 15:13:18 -0500476 auto atlasManager = target->atlasManager();
Robert Phillipsc4039ea2018-03-01 11:36:45 -0500477
Robert Phillips7cd0bfe2019-11-20 16:08:10 -0500478 GrGeometryProcessor* gp = flushInfo->fGeometryProcessor;
Jim Van Vertheafa64b2017-09-18 10:05:00 -0400479 GrMaskFormat maskFormat = this->maskFormat();
Robert Phillipsf3690dd2018-02-20 15:18:59 -0500480
Greg Daniel9715b6c2019-12-10 15:03:10 -0500481 unsigned int numActiveViews;
482 const GrSurfaceProxyView* views = atlasManager->getViews(maskFormat, &numActiveViews);
483 SkASSERT(views);
Jim Van Verth9f2516f2019-11-22 14:58:37 -0500484 // Something has gone terribly wrong, bail
Greg Daniel9715b6c2019-12-10 15:03:10 -0500485 if (!views || 0 == numActiveViews) {
Jim Van Verth9f2516f2019-11-22 14:58:37 -0500486 return;
487 }
Greg Daniel9715b6c2019-12-10 15:03:10 -0500488 if (gp->numTextureSamplers() != (int) numActiveViews) {
Jim Van Vertheafa64b2017-09-18 10:05:00 -0400489 // During preparation the number of atlas pages has increased.
490 // Update the proxies used in the GP to match.
Greg Daniel9715b6c2019-12-10 15:03:10 -0500491 for (unsigned i = gp->numTextureSamplers(); i < numActiveViews; ++i) {
492 flushInfo->fFixedDynamicState->fPrimitiveProcessorTextures[i] = views[i].proxy();
Greg Danielb20d7e52019-09-03 13:54:39 -0400493 // This op does not know its atlas proxies when it is added to a GrOpsTasks, so the
494 // proxies don't get added during the visitProxies call. Thus we add them here.
Greg Daniel9715b6c2019-12-10 15:03:10 -0500495 target->sampledProxyArray()->push_back(views[i].proxy());
Brian Salomon43cbd722020-01-03 22:09:12 -0500496 // These will get unreffed when the previously recorded draws destruct.
497 for (int d = 0; d < flushInfo->fNumDraws; ++d) {
498 flushInfo->fFixedDynamicState->fPrimitiveProcessorTextures[i]->ref();
499 }
Brian Salomon7eae3e02018-08-07 14:02:38 +0000500 }
Jim Van Vertheafa64b2017-09-18 10:05:00 -0400501 if (this->usesDistanceFields()) {
502 if (this->isLCD()) {
Greg Daniel9715b6c2019-12-10 15:03:10 -0500503 reinterpret_cast<GrDistanceFieldLCDTextGeoProc*>(gp)->addNewViews(
Brian Salomonccb61422020-01-09 10:46:36 -0500504 views, numActiveViews, GrSamplerState::Filter::kBilerp);
Jim Van Vertheafa64b2017-09-18 10:05:00 -0400505 } else {
Greg Daniel9715b6c2019-12-10 15:03:10 -0500506 reinterpret_cast<GrDistanceFieldA8TextGeoProc*>(gp)->addNewViews(
Brian Salomonccb61422020-01-09 10:46:36 -0500507 views, numActiveViews, GrSamplerState::Filter::kBilerp);
Jim Van Vertheafa64b2017-09-18 10:05:00 -0400508 }
509 } else {
Brian Salomonccb61422020-01-09 10:46:36 -0500510 auto filter = fNeedsGlyphTransform ? GrSamplerState::Filter::kBilerp
511 : GrSamplerState::Filter::kNearest;
512 reinterpret_cast<GrBitmapTextGeoProc*>(gp)->addNewViews(views, numActiveViews, filter);
Jim Van Vertheafa64b2017-09-18 10:05:00 -0400513 }
514 }
Brian Salomondbf70722019-02-07 11:31:24 -0500515 int maxGlyphsPerDraw = static_cast<int>(flushInfo->fIndexBuffer->size() / sizeof(uint16_t) / 6);
Brian Salomon7eae3e02018-08-07 14:02:38 +0000516 GrMesh* mesh = target->allocMesh(GrPrimitiveType::kTriangles);
Brian Salomon12d22642019-01-29 14:38:50 -0500517 mesh->setIndexedPatterned(flushInfo->fIndexBuffer, kIndicesPerGlyph, kVerticesPerGlyph,
Brian Salomon7eae3e02018-08-07 14:02:38 +0000518 flushInfo->fGlyphsToFlush, maxGlyphsPerDraw);
Brian Salomon12d22642019-01-29 14:38:50 -0500519 mesh->setVertexData(flushInfo->fVertexBuffer, flushInfo->fVertexOffset);
Robert Phillipscea290f2019-11-06 11:21:03 -0500520 target->recordDraw(flushInfo->fGeometryProcessor, mesh, 1, flushInfo->fFixedDynamicState,
521 nullptr, GrPrimitiveType::kTriangles);
joshualitta751c972015-11-20 13:37:32 -0800522 flushInfo->fVertexOffset += kVerticesPerGlyph * flushInfo->fGlyphsToFlush;
523 flushInfo->fGlyphsToFlush = 0;
Brian Salomon43cbd722020-01-03 22:09:12 -0500524 ++flushInfo->fNumDraws;
joshualitta751c972015-11-20 13:37:32 -0800525}
526
Michael Ludwig28b0c5d2019-12-19 14:51:00 -0500527GrOp::CombineResult GrAtlasTextOp::onCombineIfPossible(GrOp* t, GrRecordingContext::Arenas*,
528 const GrCaps& caps) {
Brian Salomon344ec422016-12-15 10:58:41 -0500529 GrAtlasTextOp* that = t->cast<GrAtlasTextOp>();
Brian Salomon44acb5b2017-07-18 19:59:24 -0400530 if (fProcessors != that->fProcessors) {
Brian Salomon7eae3e02018-08-07 14:02:38 +0000531 return CombineResult::kCannotCombine;
Brian Salomon44acb5b2017-07-18 19:59:24 -0400532 }
533
joshualitta751c972015-11-20 13:37:32 -0800534 if (fMaskType != that->fMaskType) {
Brian Salomon7eae3e02018-08-07 14:02:38 +0000535 return CombineResult::kCannotCombine;
joshualitta751c972015-11-20 13:37:32 -0800536 }
537
Herb Derby1c5be7b2019-12-13 12:03:06 -0500538 const SkMatrix& thisFirstMatrix = fGeoData[0].fDrawMatrix;
539 const SkMatrix& thatFirstMatrix = that->fGeoData[0].fDrawMatrix;
Brian Salomon5c6ac642017-12-19 11:09:32 -0500540
Mike Reed2c383152019-12-18 16:47:47 -0500541 if (this->usesLocalCoords() && !SkMatrixPriv::CheapEqual(thisFirstMatrix, thatFirstMatrix)) {
Brian Salomon7eae3e02018-08-07 14:02:38 +0000542 return CombineResult::kCannotCombine;
Brian Salomon5c6ac642017-12-19 11:09:32 -0500543 }
544
Jim Van Verthb515ae72018-05-23 16:44:55 -0400545 if (fNeedsGlyphTransform != that->fNeedsGlyphTransform) {
Brian Salomon7eae3e02018-08-07 14:02:38 +0000546 return CombineResult::kCannotCombine;
Jim Van Verthb515ae72018-05-23 16:44:55 -0400547 }
548
549 if (fNeedsGlyphTransform &&
550 (thisFirstMatrix.hasPerspective() != thatFirstMatrix.hasPerspective())) {
Brian Salomon7eae3e02018-08-07 14:02:38 +0000551 return CombineResult::kCannotCombine;
Jim Van Verthb515ae72018-05-23 16:44:55 -0400552 }
553
Brian Salomon5c6ac642017-12-19 11:09:32 -0500554 if (this->usesDistanceFields()) {
555 if (fDFGPFlags != that->fDFGPFlags) {
Brian Salomon7eae3e02018-08-07 14:02:38 +0000556 return CombineResult::kCannotCombine;
joshualitta751c972015-11-20 13:37:32 -0800557 }
558
Jim Van Verthbc2cdd12017-06-08 11:14:35 -0400559 if (fLuminanceColor != that->fLuminanceColor) {
Brian Salomon7eae3e02018-08-07 14:02:38 +0000560 return CombineResult::kCannotCombine;
joshualitta751c972015-11-20 13:37:32 -0800561 }
Brian Salomon5c6ac642017-12-19 11:09:32 -0500562 } else {
563 if (kColorBitmapMask_MaskType == fMaskType && this->color() != that->color()) {
Brian Salomon7eae3e02018-08-07 14:02:38 +0000564 return CombineResult::kCannotCombine;
Brian Salomon5c6ac642017-12-19 11:09:32 -0500565 }
joshualitta751c972015-11-20 13:37:32 -0800566 }
567
Brian Salomon344ec422016-12-15 10:58:41 -0500568 fNumGlyphs += that->numGlyphs();
joshualitta751c972015-11-20 13:37:32 -0800569
Jim Van Verth56c37142017-10-31 14:44:25 -0400570 // Reallocate space for geo data if necessary and then import that geo's data.
joshualitta751c972015-11-20 13:37:32 -0800571 int newGeoCount = that->fGeoCount + fGeoCount;
joshualitta751c972015-11-20 13:37:32 -0800572
Jim Van Verthc8a65e32017-10-25 14:25:27 -0400573 // We reallocate at a rate of 1.5x to try to get better total memory usage
574 if (newGeoCount > fGeoDataAllocSize) {
Jim Van Verth56c37142017-10-31 14:44:25 -0400575 int newAllocSize = fGeoDataAllocSize + fGeoDataAllocSize / 2;
Jim Van Verthc8a65e32017-10-25 14:25:27 -0400576 while (newAllocSize < newGeoCount) {
577 newAllocSize += newAllocSize / 2;
578 }
joshualitta751c972015-11-20 13:37:32 -0800579 fGeoData.realloc(newAllocSize);
Jim Van Verthc8a65e32017-10-25 14:25:27 -0400580 fGeoDataAllocSize = newAllocSize;
joshualitta751c972015-11-20 13:37:32 -0800581 }
582
Brian Salomon344ec422016-12-15 10:58:41 -0500583 // We steal the ref on the blobs from the other AtlasTextOp and set its count to 0 so that
joshualitta751c972015-11-20 13:37:32 -0800584 // it doesn't try to unref them.
Brian Salomon344ec422016-12-15 10:58:41 -0500585 memcpy(&fGeoData[fGeoCount], that->fGeoData.get(), that->fGeoCount * sizeof(Geometry));
joshualitta751c972015-11-20 13:37:32 -0800586#ifdef SK_DEBUG
587 for (int i = 0; i < that->fGeoCount; ++i) {
Herb Derbyc514e7d2019-12-11 17:00:31 -0500588 that->fGeoData.get()[i].fBlob = (GrTextBlob*)0x1;
joshualitta751c972015-11-20 13:37:32 -0800589 }
590#endif
591 that->fGeoCount = 0;
592 fGeoCount = newGeoCount;
593
Brian Salomon7eae3e02018-08-07 14:02:38 +0000594 return CombineResult::kMerged;
joshualitta751c972015-11-20 13:37:32 -0800595}
596
joshualitta751c972015-11-20 13:37:32 -0800597// TODO trying to figure out why lcd is so whack
Herb Derby26cbe512018-05-24 14:39:01 -0400598// (see comments in GrTextContext::ComputeCanonicalColor)
Robert Phillips7cd0bfe2019-11-20 16:08:10 -0500599GrGeometryProcessor* GrAtlasTextOp::setupDfProcessor(SkArenaAlloc* arena,
600 const GrShaderCaps& caps,
Greg Daniel9715b6c2019-12-10 15:03:10 -0500601 const GrSurfaceProxyView* views,
602 unsigned int numActiveViews) const {
joshualitta751c972015-11-20 13:37:32 -0800603 bool isLCD = this->isLCD();
Brian Salomon5c6ac642017-12-19 11:09:32 -0500604
605 SkMatrix localMatrix = SkMatrix::I();
606 if (this->usesLocalCoords()) {
607 // If this fails we'll just use I().
Herb Derby1c5be7b2019-12-13 12:03:06 -0500608 bool result = fGeoData[0].fDrawMatrix.invert(&localMatrix);
Brian Salomon5c6ac642017-12-19 11:09:32 -0500609 (void)result;
610 }
joshualitta751c972015-11-20 13:37:32 -0800611
612 // see if we need to create a new effect
613 if (isLCD) {
brianosman0586f5c2016-04-12 12:48:21 -0700614 float redCorrection = fDistanceAdjustTable->getAdjustment(
Jim Van Verth58c3cce2017-10-19 15:50:24 -0400615 SkColorGetR(fLuminanceColor) >> kDistanceAdjustLumShift,
Brian Salomon344ec422016-12-15 10:58:41 -0500616 fUseGammaCorrectDistanceTable);
brianosman0586f5c2016-04-12 12:48:21 -0700617 float greenCorrection = fDistanceAdjustTable->getAdjustment(
Jim Van Verth58c3cce2017-10-19 15:50:24 -0400618 SkColorGetG(fLuminanceColor) >> kDistanceAdjustLumShift,
Brian Salomon344ec422016-12-15 10:58:41 -0500619 fUseGammaCorrectDistanceTable);
brianosman0586f5c2016-04-12 12:48:21 -0700620 float blueCorrection = fDistanceAdjustTable->getAdjustment(
Jim Van Verth58c3cce2017-10-19 15:50:24 -0400621 SkColorGetB(fLuminanceColor) >> kDistanceAdjustLumShift,
Brian Salomon344ec422016-12-15 10:58:41 -0500622 fUseGammaCorrectDistanceTable);
joshualitta751c972015-11-20 13:37:32 -0800623 GrDistanceFieldLCDTextGeoProc::DistanceAdjust widthAdjust =
Brian Salomon344ec422016-12-15 10:58:41 -0500624 GrDistanceFieldLCDTextGeoProc::DistanceAdjust::Make(
625 redCorrection, greenCorrection, blueCorrection);
Greg Daniel9715b6c2019-12-10 15:03:10 -0500626 return GrDistanceFieldLCDTextGeoProc::Make(arena, caps, views, numActiveViews,
Brian Salomonccb61422020-01-09 10:46:36 -0500627 GrSamplerState::Filter::kBilerp, widthAdjust,
Brian Osman09068252018-01-03 09:57:29 -0500628 fDFGPFlags, localMatrix);
joshualitta751c972015-11-20 13:37:32 -0800629 } else {
joshualitta751c972015-11-20 13:37:32 -0800630#ifdef SK_GAMMA_APPLY_TO_A8
Jim Van Verth90e89b32017-07-06 16:36:55 -0400631 float correction = 0;
632 if (kAliasedDistanceField_MaskType != fMaskType) {
Jim Van Verth58c3cce2017-10-19 15:50:24 -0400633 U8CPU lum = SkColorSpaceLuminance::computeLuminance(SK_GAMMA_EXPONENT,
634 fLuminanceColor);
Jim Van Verth90e89b32017-07-06 16:36:55 -0400635 correction = fDistanceAdjustTable->getAdjustment(lum >> kDistanceAdjustLumShift,
636 fUseGammaCorrectDistanceTable);
637 }
Greg Daniel9715b6c2019-12-10 15:03:10 -0500638 return GrDistanceFieldA8TextGeoProc::Make(arena, caps, views, numActiveViews,
Brian Salomonccb61422020-01-09 10:46:36 -0500639 GrSamplerState::Filter::kBilerp, correction,
640 fDFGPFlags, localMatrix);
joshualitta751c972015-11-20 13:37:32 -0800641#else
Greg Daniel9715b6c2019-12-10 15:03:10 -0500642 return GrDistanceFieldA8TextGeoProc::Make(arena, caps, views, numActiveViews,
Brian Salomonccb61422020-01-09 10:46:36 -0500643 GrSamplerState::Filter::kBilerp,
Brian Salomon5c6ac642017-12-19 11:09:32 -0500644 fDFGPFlags, localMatrix);
joshualitta751c972015-11-20 13:37:32 -0800645#endif
646 }
joshualitta751c972015-11-20 13:37:32 -0800647}
joshualittddd22d82016-02-16 06:47:52 -0800648