Ignore local matrix when choosing CT uni type with explicit sampling.
The GP's local matrix is ignored when explicitly sampling FPs.
Add asserts to check consistency.
Change-Id: I6fc063e223affa3115f00eb63454ae5e6c1c27eb
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/278779
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
diff --git a/src/gpu/glsl/GrGLSLGeometryProcessor.cpp b/src/gpu/glsl/GrGLSLGeometryProcessor.cpp
index 45b1d6f..d9a4482 100644
--- a/src/gpu/glsl/GrGLSLGeometryProcessor.cpp
+++ b/src/gpu/glsl/GrGLSLGeometryProcessor.cpp
@@ -91,8 +91,7 @@
auto flag = fp.isSampledWithExplicitCoords() ? kFragment_GrShaderFlag
: kVertex_GrShaderFlag;
auto& uni = fInstalledTransforms.push_back();
- if (fp.isSampledWithExplicitCoords() && coordTransform.matrix().isScaleTranslate() &&
- localMatrix.isScaleTranslate()) {
+ if (fp.isSampledWithExplicitCoords() && coordTransform.matrix().isScaleTranslate()) {
uni.fType = kFloat4_GrSLType;
} else {
uni.fType = kFloat3x3_GrSLType;
@@ -149,8 +148,10 @@
if (fInstalledTransforms[i].fType == kFloat4_GrSLType) {
float values[4] = {m.getScaleX(), m.getTranslateX(),
m.getScaleY(), m.getTranslateY()};
+ SkASSERT(m.isScaleTranslate());
pdman.set4fv(fInstalledTransforms[i].fHandle.toIndex(), 1, values);
} else {
+ SkASSERT(!m.isScaleTranslate() || !fp.isSampledWithExplicitCoords());
SkASSERT(fInstalledTransforms[i].fType == kFloat3x3_GrSLType);
pdman.setSkMatrix(fInstalledTransforms[i].fHandle.toIndex(), m);
}