Set correct coord transform visibility initially rather than update.
Aside from being simpler it also makes the matrix uniforms for
explicitly sampled FPs appear only in the FS and not both VS and FS.
Change-Id: I0f7a4e83b77decacfd0567600dd2d3bc8ce5240f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/278137
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
diff --git a/src/gpu/glsl/GrGLSLGeometryProcessor.cpp b/src/gpu/glsl/GrGLSLGeometryProcessor.cpp
index 0eba2cd..0c493d0 100644
--- a/src/gpu/glsl/GrGLSLGeometryProcessor.cpp
+++ b/src/gpu/glsl/GrGLSLGeometryProcessor.cpp
@@ -87,12 +87,12 @@
if (!fp.isSampledWithExplicitCoords() || !coordTransform.isNoOp()) {
SkString strUniName;
strUniName.printf("CoordTransformMatrix_%d", i);
- fInstalledTransforms.push_back().fHandle = uniformHandler
- ->addUniform(kVertex_GrShaderFlag,
- kFloat3x3_GrSLType,
- strUniName.c_str(),
- &matrixName)
- .toIndex();
+ auto flag = fp.isSampledWithExplicitCoords() ? kFragment_GrShaderFlag
+ : kVertex_GrShaderFlag;
+ fInstalledTransforms.push_back().fHandle =
+ uniformHandler
+ ->addUniform(flag, kFloat3x3_GrSLType, strUniName.c_str(), &matrixName)
+ .toIndex();
} else {
// Install a coord transform that will be skipped.
fInstalledTransforms.push_back();