Color matrix effect rewritten as .fp
Also adds flexibility to unpremul the input, clamp the output, premul the
output or not.
Also fixes SkMatrix44 as a ctype.
The intent is to reuse this for rgb->yuv conversion in async rescale and
read.
Bug: skia:3962
Change-Id: I470d1cfebdbd79d8541b633c1747d510a5549ac4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/217128
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
diff --git a/src/gpu/glsl/GrGLSLProgramDataManager.cpp b/src/gpu/glsl/GrGLSLProgramDataManager.cpp
index 08aa70d..395e325 100644
--- a/src/gpu/glsl/GrGLSLProgramDataManager.cpp
+++ b/src/gpu/glsl/GrGLSLProgramDataManager.cpp
@@ -25,3 +25,8 @@
this->setMatrix3f(u, mt);
}
+void GrGLSLProgramDataManager::setSkMatrix44(UniformHandle u, const SkMatrix44& matrix) const {
+ float mt[16];
+ matrix.asColMajorf(mt);
+ this->setMatrix4f(u, mt);
+}
diff --git a/src/gpu/glsl/GrGLSLProgramDataManager.h b/src/gpu/glsl/GrGLSLProgramDataManager.h
index 7348082..5db4ae5 100644
--- a/src/gpu/glsl/GrGLSLProgramDataManager.h
+++ b/src/gpu/glsl/GrGLSLProgramDataManager.h
@@ -55,6 +55,8 @@
// convenience method for uploading a SkMatrix to a 3x3 matrix uniform
void setSkMatrix(UniformHandle, const SkMatrix&) const;
+ // convenience method for uploading a SkMatrix to a 4x4 matrix uniform
+ void setSkMatrix44(UniformHandle, const SkMatrix44&) const;
// for nvpr only
GR_DEFINE_RESOURCE_HANDLE_CLASS(VaryingHandle);