Index: src/gpu/gl/GrGLProgramDataManager.cpp |
diff --git a/src/gpu/gl/GrGLProgramDataManager.cpp b/src/gpu/gl/GrGLProgramDataManager.cpp |
index c4c51933c77e08b244f5a457dfc7521223bde35a..9183a6c1f5bdc2112ca6945a7110de45696fa078 100644 |
--- a/src/gpu/gl/GrGLProgramDataManager.cpp |
+++ b/src/gpu/gl/GrGLProgramDataManager.cpp |
@@ -6,6 +6,7 @@ |
*/ |
#include "gl/GrGLShaderBuilder.h" |
+#include "gl/GrGLPathRendering.h" |
#include "gl/GrGLProgram.h" |
#include "gl/GrGLUniformHandle.h" |
#include "gl/GrGpuGL.h" |
@@ -16,9 +17,10 @@ |
(1 == arrayCount && GrGLShaderVar::kNonArray == uni.fArrayCount)) |
GrGLProgramDataManager::GrGLProgramDataManager(GrGpuGL* gpu, |
- GrGLProgram*, |
+ GrGLProgram* program, |
const GrGLShaderBuilder& builder) |
- : fGpu(gpu) { |
+ : fGpu(gpu) |
+ , fProgram(program) { |
int count = builder.getUniformInfos().count(); |
fUniforms.push_back_n(count); |
for (int i = 0; i < count; i++) { |
@@ -43,6 +45,19 @@ GrGLProgramDataManager::GrGLProgramDataManager(GrGpuGL* gpu, |
uniform.fFSLocation = kUnusedUniform; |
} |
} |
+ |
+ count = builder.getSeparableVaryingInfos().count(); |
+ fVaryings.push_back_n(count); |
+ for (int i = 0; i < count; i++) { |
+ Varying& varying = fVaryings[i]; |
+ const GrGLShaderBuilder::SeparableVaryingInfo& builderVarying = |
+ builder.getSeparableVaryingInfos()[i]; |
+ SkASSERT(GrGLShaderVar::kNonArray == builderVarying.fVariable.getArrayCount()); |
+ SkDEBUGCODE( |
+ varying.fType = builderVarying.fVariable.getType(); |
+ ); |
+ varying.fLocation = builderVarying.fLocation; |
+ } |
} |
void GrGLProgramDataManager::setSampler(UniformHandle u, GrGLint texUnit) const { |
@@ -261,3 +276,33 @@ void GrGLProgramDataManager::setSkMatrix(UniformHandle u, const SkMatrix& matrix |
}; |
this->setMatrix3f(u, mt); |
} |
+ |
+void GrGLProgramDataManager::setProgramPathFragmentInputTransform(VaryingHandle i, |
+ unsigned components, |
+ const SkMatrix& matrix) const { |
+ const Varying& fragmentInput = fVaryings[i.toProgramDataIndex()]; |
+ |
+ GrGLfloat coefficients[3 * 3]; |
+ SkASSERT(components >= 1 && components <= 3); |
+ |
+ coefficients[0] = SkScalarToFloat(matrix[SkMatrix::kMScaleX]); |
+ coefficients[1] = SkScalarToFloat(matrix[SkMatrix::kMSkewX]); |
+ coefficients[2] = SkScalarToFloat(matrix[SkMatrix::kMTransX]); |
+ |
+ if (components >= 2) { |
+ coefficients[3] = SkScalarToFloat(matrix[SkMatrix::kMSkewY]); |
+ coefficients[4] = SkScalarToFloat(matrix[SkMatrix::kMScaleY]); |
+ coefficients[5] = SkScalarToFloat(matrix[SkMatrix::kMTransY]); |
+ } |
+ |
+ if (components >= 3) { |
+ coefficients[6] = SkScalarToFloat(matrix[SkMatrix::kMPersp0]); |
+ coefficients[7] = SkScalarToFloat(matrix[SkMatrix::kMPersp1]); |
+ coefficients[8] = SkScalarToFloat(matrix[SkMatrix::kMPersp2]); |
+ } |
+ fGpu->pathRendering()->programPathFragmentInputGen(fProgram->programID(), |
+ fragmentInput.fLocation, |
+ GR_GL_OBJECT_LINEAR, |
+ components, |
+ coefficients); |
+} |