Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(203)

Unified Diff: src/effects/gradients/SkTwoPointRadialGradient.cpp

Issue 491673002: Initial refactor of shaderbuilder (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/effects/gradients/SkTwoPointConicalGradient_gpu.cpp ('k') | src/gpu/GrAAConvexPathRenderer.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/effects/gradients/SkTwoPointRadialGradient.cpp
diff --git a/src/effects/gradients/SkTwoPointRadialGradient.cpp b/src/effects/gradients/SkTwoPointRadialGradient.cpp
index 754a53261b722df5658c9f171bc14814ca1bc55b..bb5ec04bfd978d25fef7d6c4c725e5a2369172bb 100644
--- a/src/effects/gradients/SkTwoPointRadialGradient.cpp
+++ b/src/effects/gradients/SkTwoPointRadialGradient.cpp
@@ -398,7 +398,7 @@ void SkTwoPointRadialGradient::init() {
#if SK_SUPPORT_GPU
#include "GrTBackendEffectFactory.h"
-#include "gl/GrGLShaderBuilder.h"
+#include "gl/builders/GrGLProgramBuilder.h"
#include "SkGr.h"
// For brevity
@@ -411,7 +411,7 @@ public:
GrGLRadial2Gradient(const GrBackendEffectFactory& factory, const GrDrawEffect&);
virtual ~GrGLRadial2Gradient() { }
- virtual void emitCode(GrGLShaderBuilder*,
+ virtual void emitCode(GrGLProgramBuilder*,
const GrDrawEffect&,
const GrEffectKey&,
const char* outputColor,
@@ -567,7 +567,7 @@ GrGLRadial2Gradient::GrGLRadial2Gradient(const GrBackendEffectFactory& factory,
fIsDegenerate = data.isDegenerate();
}
-void GrGLRadial2Gradient::emitCode(GrGLShaderBuilder* builder,
+void GrGLRadial2Gradient::emitCode(GrGLProgramBuilder* builder,
const GrDrawEffect& drawEffect,
const GrEffectKey& key,
const char* outputColor,
@@ -576,7 +576,7 @@ void GrGLRadial2Gradient::emitCode(GrGLShaderBuilder* builder,
const TextureSamplerArray& samplers) {
uint32_t baseKey = key.get32(0);
this->emitUniforms(builder, baseKey);
- fParamUni = builder->addUniformArray(GrGLShaderBuilder::kFragment_Visibility,
+ fParamUni = builder->addUniformArray(GrGLProgramBuilder::kFragment_Visibility,
kFloat_GrSLType, "Radial2FSParams", 6);
SkString cName("c");
@@ -596,12 +596,13 @@ void GrGLRadial2Gradient::emitCode(GrGLShaderBuilder* builder,
builder->getUniformVariable(fParamUni).appendArrayAccess(4, &p4);
builder->getUniformVariable(fParamUni).appendArrayAccess(5, &p5);
+ GrGLFragmentShaderBuilder* fsBuilder = builder->getFragmentShaderBuilder();
// We interpolate the linear component in coords[1].
SkASSERT(coords[0].type() == coords[1].type());
const char* coords2D;
SkString bVar;
if (kVec3f_GrSLType == coords[0].type()) {
- builder->fsCodeAppendf("\tvec3 interpolants = vec3(%s.xy, %s.x) / %s.z;\n",
+ fsBuilder->codeAppendf("\tvec3 interpolants = vec3(%s.xy, %s.x) / %s.z;\n",
coords[0].c_str(), coords[1].c_str(), coords[0].c_str());
coords2D = "interpolants.xy";
bVar = "interpolants.z";
@@ -611,7 +612,7 @@ void GrGLRadial2Gradient::emitCode(GrGLShaderBuilder* builder,
}
// c = (x^2)+(y^2) - params[4]
- builder->fsCodeAppendf("\tfloat %s = dot(%s, %s) - %s;\n",
+ fsBuilder->codeAppendf("\tfloat %s = dot(%s, %s) - %s;\n",
cName.c_str(), coords2D, coords2D, p4.c_str());
// If we aren't degenerate, emit some extra code, and accept a slightly
@@ -619,13 +620,13 @@ void GrGLRadial2Gradient::emitCode(GrGLShaderBuilder* builder,
if (!fIsDegenerate) {
// ac4 = 4.0 * params[0] * c
- builder->fsCodeAppendf("\tfloat %s = %s * 4.0 * %s;\n",
+ fsBuilder->codeAppendf("\tfloat %s = %s * 4.0 * %s;\n",
ac4Name.c_str(), p0.c_str(),
cName.c_str());
// root = sqrt(b^2-4ac)
// (abs to avoid exception due to fp precision)
- builder->fsCodeAppendf("\tfloat %s = sqrt(abs(%s*%s - %s));\n",
+ fsBuilder->codeAppendf("\tfloat %s = sqrt(abs(%s*%s - %s));\n",
rootName.c_str(), bVar.c_str(), bVar.c_str(),
ac4Name.c_str());
« no previous file with comments | « src/effects/gradients/SkTwoPointConicalGradient_gpu.cpp ('k') | src/gpu/GrAAConvexPathRenderer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698