blob: d87ee465ea19e530d85ef4ba533cc1ed5d37fd3b [file] [log] [blame]
joshualitt8072caa2015-02-12 14:20:52 -08001/*
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
Robert Phillips787fd9d2021-03-22 14:48:09 -04008#include "src/gpu/GrGeometryProcessor.h"
joshualitt8072caa2015-02-12 14:20:52 -08009
Brian Salomon48959462021-08-11 13:01:06 -040010#include "src/core/SkMatrixPriv.h"
11#include "src/gpu/GrPipeline.h"
12#include "src/gpu/glsl/GrGLSLFragmentShaderBuilder.h"
13#include "src/gpu/glsl/GrGLSLProgramBuilder.h"
14#include "src/gpu/glsl/GrGLSLUniformHandler.h"
15#include "src/gpu/glsl/GrGLSLVarying.h"
joshualitt8072caa2015-02-12 14:20:52 -080016
Brian Salomon48959462021-08-11 13:01:06 -040017#include <queue>
joshualitt8072caa2015-02-12 14:20:52 -080018
Robert Phillips787fd9d2021-03-22 14:48:09 -040019GrGeometryProcessor::GrGeometryProcessor(ClassID classID) : GrProcessor(classID) {}
Brian Salomone782f842018-07-31 13:53:11 -040020
Robert Phillips787fd9d2021-03-22 14:48:09 -040021const GrGeometryProcessor::TextureSampler& GrGeometryProcessor::textureSampler(int i) const {
Brian Salomone782f842018-07-31 13:53:11 -040022 SkASSERT(i >= 0 && i < this->numTextureSamplers());
23 return this->onTextureSampler(i);
24}
Brian Salomon92be2f72018-06-19 14:33:47 -040025
Robert Phillips787fd9d2021-03-22 14:48:09 -040026uint32_t GrGeometryProcessor::ComputeCoordTransformsKey(const GrFragmentProcessor& fp) {
Brian Salomonf95940b2021-08-09 15:56:24 -040027 // This is highly coupled with the code in ProgramImpl::collectTransforms().
Brian Salomon66b500a2021-08-02 12:37:14 -040028 uint32_t key = static_cast<uint32_t>(fp.sampleUsage().kind()) << 1;
29 // This needs to be updated if GP starts specializing varyings on additional matrix types.
30 if (fp.sampleUsage().hasPerspective()) {
31 key |= 0b1;
joshualitt8072caa2015-02-12 14:20:52 -080032 }
Michael Ludwige88320b2020-06-24 09:04:56 -040033 return key;
joshualitt8072caa2015-02-12 14:20:52 -080034}
Brian Salomone782f842018-07-31 13:53:11 -040035
36///////////////////////////////////////////////////////////////////////////////////////////////////
37
Brian Salomon7eae3e02018-08-07 14:02:38 +000038static inline GrSamplerState::Filter clamp_filter(GrTextureType type,
39 GrSamplerState::Filter requestedFilter) {
40 if (GrTextureTypeHasRestrictedSampling(type)) {
Brian Salomona3b02f52020-07-15 16:02:01 -040041 return std::min(requestedFilter, GrSamplerState::Filter::kLinear);
Brian Salomon7eae3e02018-08-07 14:02:38 +000042 }
43 return requestedFilter;
Brian Salomonaf874832018-08-03 11:53:40 -040044}
45
Robert Phillips787fd9d2021-03-22 14:48:09 -040046GrGeometryProcessor::TextureSampler::TextureSampler(GrSamplerState samplerState,
47 const GrBackendFormat& backendFormat,
48 const GrSwizzle& swizzle) {
Robert Phillips323471e2019-11-11 11:33:37 -050049 this->reset(samplerState, backendFormat, swizzle);
Brian Salomon7eae3e02018-08-07 14:02:38 +000050}
51
Robert Phillips787fd9d2021-03-22 14:48:09 -040052void GrGeometryProcessor::TextureSampler::reset(GrSamplerState samplerState,
53 const GrBackendFormat& backendFormat,
54 const GrSwizzle& swizzle) {
Brian Salomone782f842018-07-31 13:53:11 -040055 fSamplerState = samplerState;
Robert Phillipsf272bea2019-10-17 08:56:16 -040056 fSamplerState.setFilterMode(clamp_filter(backendFormat.textureType(), samplerState.filter()));
57 fBackendFormat = backendFormat;
Greg Daniel2c3398d2019-06-19 11:58:01 -040058 fSwizzle = swizzle;
Brian Salomon67529b22019-08-13 15:31:04 -040059 fIsInitialized = true;
Brian Salomone782f842018-07-31 13:53:11 -040060}
Brian Salomon48959462021-08-11 13:01:06 -040061
62//////////////////////////////////////////////////////////////////////////////
63
64using ProgramImpl = GrGeometryProcessor::ProgramImpl;
65
66ProgramImpl::FPCoordsMap ProgramImpl::emitCode(EmitArgs& args, const GrPipeline& pipeline) {
67 GrGPArgs gpArgs;
68 this->onEmitCode(args, &gpArgs);
69
70 GrShaderVar positionVar = gpArgs.fPositionVar;
71 // skia:12198
72 if (args.fGeomProc.willUseGeoShader() || args.fGeomProc.willUseTessellationShaders()) {
73 positionVar = {};
74 }
75 FPCoordsMap transformMap = this->collectTransforms(args.fVertBuilder,
76 args.fVaryingHandler,
77 args.fUniformHandler,
78 gpArgs.fLocalCoordVar,
79 positionVar,
80 pipeline);
81
82 if (args.fGeomProc.willUseTessellationShaders()) {
83 // Tessellation shaders are temporarily responsible for integrating their own code strings
84 // while we work out full support.
85 return transformMap;
86 }
87
88 GrGLSLVertexBuilder* vBuilder = args.fVertBuilder;
89 if (!args.fGeomProc.willUseGeoShader()) {
90 // Emit the vertex position to the hardware in the normalized window coordinates it expects.
91 SkASSERT(kFloat2_GrSLType == gpArgs.fPositionVar.getType() ||
92 kFloat3_GrSLType == gpArgs.fPositionVar.getType());
93 vBuilder->emitNormalizedSkPosition(gpArgs.fPositionVar.c_str(),
94 gpArgs.fPositionVar.getType());
95 if (kFloat2_GrSLType == gpArgs.fPositionVar.getType()) {
96 args.fVaryingHandler->setNoPerspective();
97 }
98 } else {
99 // Since we have a geometry shader, leave the vertex position in Skia device space for now.
100 // The geometry Shader will operate in device space, and then convert the final positions to
101 // normalized hardware window coordinates under the hood, once everything else has finished.
102 // The subclass must call setNoPerspective on the varying handler, if applicable.
103 vBuilder->codeAppendf("sk_Position = float4(%s", gpArgs.fPositionVar.c_str());
104 switch (gpArgs.fPositionVar.getType()) {
105 case kFloat_GrSLType:
106 vBuilder->codeAppend(", 0");
107 [[fallthrough]];
108 case kFloat2_GrSLType:
109 vBuilder->codeAppend(", 0");
110 [[fallthrough]];
111 case kFloat3_GrSLType:
112 vBuilder->codeAppend(", 1");
113 [[fallthrough]];
114 case kFloat4_GrSLType:
115 vBuilder->codeAppend(");");
116 break;
117 default:
118 SK_ABORT("Invalid position var type");
119 break;
120 }
121 }
122 return transformMap;
123}
124
125ProgramImpl::FPCoordsMap ProgramImpl::collectTransforms(GrGLSLVertexBuilder* vb,
126 GrGLSLVaryingHandler* varyingHandler,
127 GrGLSLUniformHandler* uniformHandler,
128 const GrShaderVar& localCoordsVar,
129 const GrShaderVar& positionVar,
130 const GrPipeline& pipeline) {
131 SkASSERT(localCoordsVar.getType() == kFloat2_GrSLType ||
132 localCoordsVar.getType() == kFloat3_GrSLType ||
133 localCoordsVar.getType() == kVoid_GrSLType);
134 SkASSERT(positionVar.getType() == kFloat2_GrSLType ||
135 positionVar.getType() == kFloat3_GrSLType ||
136 positionVar.getType() == kVoid_GrSLType);
137
138 enum class BaseCoord { kNone, kLocal, kPosition };
139
140 auto baseLocalCoordFSVar = [&, baseLocalCoord = GrGLSLVarying()]() mutable {
141 SkASSERT(GrSLTypeIsFloatType(localCoordsVar.getType()));
142 if (baseLocalCoord.type() == kVoid_GrSLType) {
143 // Initialize to the GP provided coordinate
144 baseLocalCoord = GrGLSLVarying(localCoordsVar.getType());
145 varyingHandler->addVarying("LocalCoord", &baseLocalCoord);
146 vb->codeAppendf("%s = %s;\n", baseLocalCoord.vsOut(), localCoordsVar.getName().c_str());
147 }
148 return baseLocalCoord.fsInVar();
149 };
150
151 bool canUsePosition = positionVar.getType() != kVoid_GrSLType;
152
153 FPCoordsMap result;
154 // Performs a pre-order traversal of FP hierarchy rooted at fp and identifies FPs that are
155 // sampled with a series of matrices applied to local coords. For each such FP a varying is
156 // added to the varying handler and added to 'result'.
157 auto liftTransforms = [&, traversalIndex = 0](
158 auto& self,
159 const GrFragmentProcessor& fp,
160 bool hasPerspective,
161 const GrFragmentProcessor* lastMatrixFP = nullptr,
162 int lastMatrixTraversalIndex = -1,
163 BaseCoord baseCoord = BaseCoord::kLocal) mutable -> void {
164 ++traversalIndex;
165 switch (fp.sampleUsage().kind()) {
166 case SkSL::SampleUsage::Kind::kNone:
167 // This should only happen at the root. Otherwise how did this FP get added?
168 SkASSERT(!fp.parent());
169 break;
170 case SkSL::SampleUsage::Kind::kPassThrough:
171 break;
172 case SkSL::SampleUsage::Kind::kUniformMatrix:
173 // Update tracking of last matrix and matrix props.
174 hasPerspective |= fp.sampleUsage().hasPerspective();
175 lastMatrixFP = &fp;
176 lastMatrixTraversalIndex = traversalIndex;
177 break;
178 case SkSL::SampleUsage::Kind::kFragCoord:
179 hasPerspective = positionVar.getType() == kFloat3_GrSLType;
180 lastMatrixFP = nullptr;
181 lastMatrixTraversalIndex = -1;
182 baseCoord = BaseCoord::kPosition;
183 break;
184 case SkSL::SampleUsage::Kind::kExplicit:
185 baseCoord = BaseCoord::kNone;
186 break;
187 }
188
189 auto& [varyingFSVar, hasCoordsParam] = result[&fp];
190 hasCoordsParam = fp.usesSampleCoordsDirectly();
191
192 // We add a varying if we're in a chain of matrices multiplied by local or device coords.
193 // If the coord is the untransformed local coord we add a varying. We don't if it is
194 // untransformed device coords since it doesn't save us anything over "sk_FragCoord.xy". Of
195 // course, if the FP doesn't directly use its coords then we don't add a varying.
196 if (fp.usesSampleCoordsDirectly() &&
197 (baseCoord == BaseCoord::kLocal ||
198 (baseCoord == BaseCoord::kPosition && lastMatrixFP && canUsePosition))) {
199 // Associate the varying with the highest possible node in the FP tree that shares the
200 // same coordinates so that multiple FPs in a subtree can share. If there are no matrix
201 // sample nodes on the way up the tree then directly use the local coord.
202 if (!lastMatrixFP) {
203 varyingFSVar = baseLocalCoordFSVar();
204 } else {
205 // If there is an already a varying that incorporates all matrices from the root to
206 // lastMatrixFP just use it. Otherwise, we add it.
207 auto& [varying, inputCoords, varyingIdx] = fTransformVaryingsMap[lastMatrixFP];
208 if (varying.type() == kVoid_GrSLType) {
209 varying = GrGLSLVarying(hasPerspective ? kFloat3_GrSLType : kFloat2_GrSLType);
210 SkString strVaryingName = SkStringPrintf("TransformedCoords_%d",
211 lastMatrixTraversalIndex);
212 varyingHandler->addVarying(strVaryingName.c_str(), &varying);
213 inputCoords = baseCoord == BaseCoord::kLocal ? localCoordsVar : positionVar;
214 varyingIdx = lastMatrixTraversalIndex;
215 }
216 SkASSERT(varyingIdx == lastMatrixTraversalIndex);
217 // The FP will use the varying in the fragment shader as its coords.
218 varyingFSVar = varying.fsInVar();
219 }
220 hasCoordsParam = false;
221 }
222
223 for (int c = 0; c < fp.numChildProcessors(); ++c) {
224 if (auto* child = fp.childProcessor(c)) {
225 self(self,
226 *child,
227 hasPerspective,
228 lastMatrixFP,
229 lastMatrixTraversalIndex,
230 baseCoord);
231 // If we have a varying then we never need a param. Otherwise, if one of our
232 // children takes a non-explicit coord then we'll need our coord.
233 hasCoordsParam |= varyingFSVar.getType() == kVoid_GrSLType &&
234 !child->sampleUsage().isExplicit() &&
235 !child->sampleUsage().isFragCoord() &&
236 result[child].hasCoordsParam;
237 }
238 }
239 };
240
241 bool hasPerspective = GrSLTypeVecLength(localCoordsVar.getType()) == 3;
242 for (int i = 0; i < pipeline.numFragmentProcessors(); ++i) {
243 liftTransforms(liftTransforms, pipeline.getFragmentProcessor(i), hasPerspective);
244 }
245 return result;
246}
247
248void ProgramImpl::emitTransformCode(GrGLSLVertexBuilder* vb, GrGLSLUniformHandler* uniformHandler) {
249 // Because descendant varyings may be computed using the varyings of ancestor FPs we make
250 // sure to visit the varyings according to FP pre-order traversal by dumping them into a
251 // priority queue.
252 using FPAndInfo = std::tuple<const GrFragmentProcessor*, TransformInfo>;
253 auto compare = [](const FPAndInfo& a, const FPAndInfo& b) {
254 return std::get<1>(a).traversalOrder > std::get<1>(b).traversalOrder;
255 };
256 std::priority_queue<FPAndInfo, std::vector<FPAndInfo>, decltype(compare)> pq(compare);
257 std::for_each(fTransformVaryingsMap.begin(), fTransformVaryingsMap.end(), [&pq](auto entry) {
258 pq.push(entry);
259 });
260 for (; !pq.empty(); pq.pop()) {
261 const auto& [fp, info] = pq.top();
262 // If we recorded a transform info, its sample matrix must be uniform
263 SkASSERT(fp->sampleUsage().isUniformMatrix());
264 GrShaderVar uniform = uniformHandler->liftUniformToVertexShader(
265 *fp->parent(), SkString(SkSL::SampleUsage::MatrixUniformName()));
266 // Start with this matrix and accumulate additional matrices as we walk up the FP tree
267 // to either the base coords or an ancestor FP that has an associated varying.
268 SkString transformExpression = uniform.getName();
269
270 // If we hit an ancestor with a varying on our walk up then save off the varying as the
271 // input to our accumulated transformExpression. Start off assuming we'll reach the root.
272 GrShaderVar inputCoords = info.inputCoords;
273
274 for (const auto* base = fp->parent(); base; base = base->parent()) {
275 if (auto iter = fTransformVaryingsMap.find(base); iter != fTransformVaryingsMap.end()) {
276 // Can stop here, as this varying already holds all transforms from higher FPs
277 // We'll apply the residual transformExpression we've accumulated up from our
278 // starting FP to this varying.
279 inputCoords = iter->second.varying.vsOutVar();
280 break;
281 } else if (base->sampleUsage().isUniformMatrix()) {
282 // Accumulate any matrices along the path to either the original local/device coords
283 // or a parent varying. Getting here means this FP was sampled with a uniform matrix
284 // but all uses of coords below here in the FP hierarchy are beneath additional
285 // matrix samples and thus this node wasn't assigned a varying.
286 GrShaderVar parentUniform = uniformHandler->liftUniformToVertexShader(
287 *base->parent(), SkString(SkSL::SampleUsage::MatrixUniformName()));
288 transformExpression.appendf(" * %s", parentUniform.getName().c_str());
289 } else if (base->sampleUsage().isFragCoord()) {
290 // Our chain of matrices starts here and is based on the device space position.
291 break;
292 } else {
293 // This intermediate FP is just a pass through and doesn't need to be built
294 // in to the expression, but we must visit its parents in case they add transforms.
295 SkASSERT(base->sampleUsage().isPassThrough() || !base->sampleUsage().isSampled());
296 }
297 }
298
299 SkString inputStr;
300 if (inputCoords.getType() == kFloat2_GrSLType) {
301 inputStr = SkStringPrintf("%s.xy1", inputCoords.getName().c_str());
302 } else {
303 SkASSERT(inputCoords.getType() == kFloat3_GrSLType);
304 inputStr = inputCoords.getName();
305 }
306
307 vb->codeAppend("{\n");
308 if (info.varying.type() == kFloat2_GrSLType) {
309 if (vb->getProgramBuilder()->shaderCaps()->nonsquareMatrixSupport()) {
310 vb->codeAppendf("%s = float3x2(%s) * %s",
311 info.varying.vsOut(),
312 transformExpression.c_str(),
313 inputStr.c_str());
314 } else {
315 vb->codeAppendf("%s = (%s * %s).xy",
316 info.varying.vsOut(),
317 transformExpression.c_str(),
318 inputStr.c_str());
319 }
320 } else {
321 SkASSERT(info.varying.type() == kFloat3_GrSLType);
322 vb->codeAppendf("%s = %s * %s",
323 info.varying.vsOut(),
324 transformExpression.c_str(),
325 inputStr.c_str());
326 }
327 vb->codeAppend(";\n");
328 vb->codeAppend("}\n");
329 }
330 // We don't need this map anymore.
331 fTransformVaryingsMap.clear();
332}
333
334void ProgramImpl::setupUniformColor(GrGLSLFPFragmentBuilder* fragBuilder,
335 GrGLSLUniformHandler* uniformHandler,
336 const char* outputName,
337 UniformHandle* colorUniform) {
338 SkASSERT(colorUniform);
339 const char* stagedLocalVarName;
340 *colorUniform = uniformHandler->addUniform(nullptr,
341 kFragment_GrShaderFlag,
342 kHalf4_GrSLType,
343 "Color",
344 &stagedLocalVarName);
345 fragBuilder->codeAppendf("%s = %s;", outputName, stagedLocalVarName);
346 if (fragBuilder->getProgramBuilder()->shaderCaps()->mustObfuscateUniformColor()) {
347 fragBuilder->codeAppendf("%s = max(%s, half4(0));", outputName, outputName);
348 }
349}
350
351void ProgramImpl::SetTransform(const GrGLSLProgramDataManager& pdman,
352 const GrShaderCaps& shaderCaps,
353 const UniformHandle& uniform,
354 const SkMatrix& matrix,
355 SkMatrix* state) {
356 if (!uniform.isValid() || (state && SkMatrixPriv::CheapEqual(*state, matrix))) {
357 // No update needed
358 return;
359 }
360 if (state) {
361 *state = matrix;
362 }
363 if (matrix.isScaleTranslate() && !shaderCaps.reducedShaderMode()) {
364 // ComputeMatrixKey and writeX() assume the uniform is a float4 (can't assert since nothing
365 // is exposed on a handle, but should be caught lower down).
366 float values[4] = {matrix.getScaleX(), matrix.getTranslateX(),
367 matrix.getScaleY(), matrix.getTranslateY()};
368 pdman.set4fv(uniform, 1, values);
369 } else {
370 pdman.setSkMatrix(uniform, matrix);
371 }
372}
373
374static void write_passthrough_vertex_position(GrGLSLVertexBuilder* vertBuilder,
375 const GrShaderVar& inPos,
376 GrShaderVar* outPos) {
377 SkASSERT(inPos.getType() == kFloat3_GrSLType || inPos.getType() == kFloat2_GrSLType);
378 SkString outName = vertBuilder->newTmpVarName(inPos.getName().c_str());
379 outPos->set(inPos.getType(), outName.c_str());
380 vertBuilder->codeAppendf("float%d %s = %s;",
381 GrSLTypeVecLength(inPos.getType()),
382 outName.c_str(),
383 inPos.getName().c_str());
384}
385
386static void write_vertex_position(GrGLSLVertexBuilder* vertBuilder,
387 GrGLSLUniformHandler* uniformHandler,
388 const GrShaderCaps& shaderCaps,
389 const GrShaderVar& inPos,
390 const SkMatrix& matrix,
391 const char* matrixName,
392 GrShaderVar* outPos,
393 ProgramImpl::UniformHandle* matrixUniform) {
394 SkASSERT(inPos.getType() == kFloat3_GrSLType || inPos.getType() == kFloat2_GrSLType);
395 SkString outName = vertBuilder->newTmpVarName(inPos.getName().c_str());
396
397 if (matrix.isIdentity() && !shaderCaps.reducedShaderMode()) {
398 write_passthrough_vertex_position(vertBuilder, inPos, outPos);
399 return;
400 }
401 SkASSERT(matrixUniform);
402
403 bool useCompactTransform = matrix.isScaleTranslate() && !shaderCaps.reducedShaderMode();
404 const char* mangledMatrixName;
405 *matrixUniform = uniformHandler->addUniform(nullptr,
406 kVertex_GrShaderFlag,
407 useCompactTransform ? kFloat4_GrSLType
408 : kFloat3x3_GrSLType,
409 matrixName,
410 &mangledMatrixName);
411
412 if (inPos.getType() == kFloat3_GrSLType) {
413 // A float3 stays a float3 whether or not the matrix adds perspective
414 if (useCompactTransform) {
415 vertBuilder->codeAppendf("float3 %s = %s.xz1 * %s + %s.yw0;\n",
416 outName.c_str(),
417 mangledMatrixName,
418 inPos.getName().c_str(),
419 mangledMatrixName);
420 } else {
421 vertBuilder->codeAppendf("float3 %s = %s * %s;\n",
422 outName.c_str(),
423 mangledMatrixName,
424 inPos.getName().c_str());
425 }
426 outPos->set(kFloat3_GrSLType, outName.c_str());
427 return;
428 }
429 if (matrix.hasPerspective()) {
430 // A float2 is promoted to a float3 if we add perspective via the matrix
431 SkASSERT(!useCompactTransform);
432 vertBuilder->codeAppendf("float3 %s = (%s * %s.xy1);",
433 outName.c_str(),
434 mangledMatrixName,
435 inPos.getName().c_str());
436 outPos->set(kFloat3_GrSLType, outName.c_str());
437 return;
438 }
439 if (useCompactTransform) {
440 vertBuilder->codeAppendf("float2 %s = %s.xz * %s + %s.yw;\n",
441 outName.c_str(),
442 mangledMatrixName,
443 inPos.getName().c_str(),
444 mangledMatrixName);
445 } else if (shaderCaps.nonsquareMatrixSupport()) {
446 vertBuilder->codeAppendf("float2 %s = float3x2(%s) * %s.xy1;\n",
447 outName.c_str(),
448 mangledMatrixName,
449 inPos.getName().c_str());
450 } else {
451 vertBuilder->codeAppendf("float2 %s = (%s * %s.xy1).xy;\n",
452 outName.c_str(),
453 mangledMatrixName,
454 inPos.getName().c_str());
455 }
456 outPos->set(kFloat2_GrSLType, outName.c_str());
457}
458
459void ProgramImpl::WriteOutputPosition(GrGLSLVertexBuilder* vertBuilder,
460 GrGPArgs* gpArgs,
461 const char* posName) {
462 // writeOutputPosition assumes the incoming pos name points to a float2 variable
463 GrShaderVar inPos(posName, kFloat2_GrSLType);
464 write_passthrough_vertex_position(vertBuilder, inPos, &gpArgs->fPositionVar);
465}
466
467void ProgramImpl::WriteOutputPosition(GrGLSLVertexBuilder* vertBuilder,
468 GrGLSLUniformHandler* uniformHandler,
469 const GrShaderCaps& shaderCaps,
470 GrGPArgs* gpArgs,
471 const char* posName,
472 const SkMatrix& mat,
473 UniformHandle* viewMatrixUniform) {
474 GrShaderVar inPos(posName, kFloat2_GrSLType);
475 write_vertex_position(vertBuilder,
476 uniformHandler,
477 shaderCaps,
478 inPos,
479 mat,
480 "viewMatrix",
481 &gpArgs->fPositionVar,
482 viewMatrixUniform);
483}
484
485void ProgramImpl::WriteLocalCoord(GrGLSLVertexBuilder* vertBuilder,
486 GrGLSLUniformHandler* uniformHandler,
487 const GrShaderCaps& shaderCaps,
488 GrGPArgs* gpArgs,
489 GrShaderVar localVar,
490 const SkMatrix& localMatrix,
491 UniformHandle* localMatrixUniform) {
492 write_vertex_position(vertBuilder,
493 uniformHandler,
494 shaderCaps,
495 localVar,
496 localMatrix,
497 "localMatrix",
498 &gpArgs->fLocalCoordVar,
499 localMatrixUniform);
500}