diff --git a/src/effects/gradients/SkTwoPointConicalGradient_gpu.cpp b/src/effects/gradients/SkTwoPointConicalGradient_gpu.cpp index 83d5af8614..5b0855ab7c 100644 --- a/src/effects/gradients/SkTwoPointConicalGradient_gpu.cpp +++ b/src/effects/gradients/SkTwoPointConicalGradient_gpu.cpp @@ -227,9 +227,9 @@ void GLEdge2PtConicalEffect::emitCode(EmitArgs& args) { const Edge2PtConicalEffect& ge = args.fFp.cast(); GrGLSLUniformHandler* uniformHandler = args.fUniformHandler; this->emitUniforms(uniformHandler, ge); - fParamUni = uniformHandler->addUniformArray(kFragment_GrShaderFlag, - kFloat_GrSLType, kDefault_GrSLPrecision, - "Conical2FSParams", 3); + fParamUni = uniformHandler->addUniform(kFragment_GrShaderFlag, + kVec3f_GrSLType, kDefault_GrSLPrecision, + "Conical2FSParams"); SkString cName("c"); SkString tName("t"); @@ -237,9 +237,10 @@ void GLEdge2PtConicalEffect::emitCode(EmitArgs& args) { SkString p1; // start radius squared SkString p2; // difference in radii (r1 - r0) - uniformHandler->getUniformVariable(fParamUni).appendArrayAccess(0, &p0); - uniformHandler->getUniformVariable(fParamUni).appendArrayAccess(1, &p1); - uniformHandler->getUniformVariable(fParamUni).appendArrayAccess(2, &p2); + + p0.appendf("%s.x", uniformHandler->getUniformVariable(fParamUni).getName().c_str()); + p1.appendf("%s.y", uniformHandler->getUniformVariable(fParamUni).getName().c_str()); + p2.appendf("%s.z", uniformHandler->getUniformVariable(fParamUni).getName().c_str()); // We interpolate the linear component in coords[1]. SkASSERT(args.fCoords[0].getType() == args.fCoords[1].getType()); @@ -294,13 +295,8 @@ void GLEdge2PtConicalEffect::onSetData(const GrGLSLProgramDataManager& pdman, if (fCachedRadius != radius0 || fCachedDiffRadius != diffRadius) { - float values[3] = { - SkScalarToFloat(radius0), - SkScalarToFloat(SkScalarMul(radius0, radius0)), - SkScalarToFloat(diffRadius) - }; - - pdman.set1fv(fParamUni, 3, values); + pdman.set3f(fParamUni, SkScalarToFloat(radius0), + SkScalarToFloat(SkScalarMul(radius0, radius0)), SkScalarToFloat(diffRadius)); fCachedRadius = radius0; fCachedDiffRadius = diffRadius; } @@ -510,15 +506,15 @@ void GLFocalOutside2PtConicalEffect::emitCode(EmitArgs& args) { const FocalOutside2PtConicalEffect& ge = args.fFp.cast(); GrGLSLUniformHandler* uniformHandler = args.fUniformHandler; this->emitUniforms(uniformHandler, ge); - fParamUni = uniformHandler->addUniformArray(kFragment_GrShaderFlag, - kFloat_GrSLType, kDefault_GrSLPrecision, - "Conical2FSParams", 2); + fParamUni = uniformHandler->addUniform(kFragment_GrShaderFlag, + kVec2f_GrSLType, kDefault_GrSLPrecision, + "Conical2FSParams"); SkString tName("t"); SkString p0; // focalX SkString p1; // 1 - focalX * focalX - uniformHandler->getUniformVariable(fParamUni).appendArrayAccess(0, &p0); - uniformHandler->getUniformVariable(fParamUni).appendArrayAccess(1, &p1); + p0.appendf("%s.x", uniformHandler->getUniformVariable(fParamUni).getName().c_str()); + p1.appendf("%s.y", uniformHandler->getUniformVariable(fParamUni).getName().c_str()); // if we have a vec3 from being in perspective, convert it to a vec2 first GrGLSLFPFragmentBuilder* fragBuilder = args.fFragBuilder; @@ -568,12 +564,7 @@ void GLFocalOutside2PtConicalEffect::onSetData(const GrGLSLProgramDataManager& p if (fCachedFocal != focal) { SkScalar oneMinus2F = 1.f - SkScalarMul(focal, focal); - float values[2] = { - SkScalarToFloat(focal), - SkScalarToFloat(oneMinus2F), - }; - - pdman.set1fv(fParamUni, 2, values); + pdman.set2f(fParamUni, SkScalarToFloat(focal), SkScalarToFloat(oneMinus2F)); fCachedFocal = focal; } }