FPs now use the correct builder types(just a rename)
BUG=skia: Review URL: https://codereview.chromium.org/648463003
This commit is contained in:
parent
1119c87065
commit
1598899975
@ -813,7 +813,7 @@ public:
|
|||||||
GLProcessor(const GrBackendProcessorFactory& factory, const GrProcessor&)
|
GLProcessor(const GrBackendProcessorFactory& factory, const GrProcessor&)
|
||||||
: INHERITED(factory) {
|
: INHERITED(factory) {
|
||||||
}
|
}
|
||||||
virtual void emitCode(GrGLProgramBuilder* builder,
|
virtual void emitCode(GrGLFPBuilder* builder,
|
||||||
const GrFragmentProcessor& fp,
|
const GrFragmentProcessor& fp,
|
||||||
const GrProcessorKey& key,
|
const GrProcessorKey& key,
|
||||||
const char* outputColor,
|
const char* outputColor,
|
||||||
@ -823,7 +823,7 @@ public:
|
|||||||
SkXfermode::Mode mode = fp.cast<XferEffect>().mode();
|
SkXfermode::Mode mode = fp.cast<XferEffect>().mode();
|
||||||
const GrTexture* backgroundTex =
|
const GrTexture* backgroundTex =
|
||||||
fp.cast<XferEffect>().backgroundAccess().getTexture();
|
fp.cast<XferEffect>().backgroundAccess().getTexture();
|
||||||
GrGLFragmentShaderBuilder* fsBuilder = builder->getFragmentShaderBuilder();
|
GrGLFPFragmentBuilder* fsBuilder = builder->getFragmentShaderBuilder();
|
||||||
const char* dstColor;
|
const char* dstColor;
|
||||||
if (backgroundTex) {
|
if (backgroundTex) {
|
||||||
dstColor = "bgColor";
|
dstColor = "bgColor";
|
||||||
@ -973,7 +973,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static void HardLight(GrGLFragmentShaderBuilder* fsBuilder,
|
static void HardLight(GrGLFPFragmentBuilder* fsBuilder,
|
||||||
const char* final,
|
const char* final,
|
||||||
const char* src,
|
const char* src,
|
||||||
const char* dst) {
|
const char* dst) {
|
||||||
@ -992,7 +992,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Does one component of color-dodge
|
// Does one component of color-dodge
|
||||||
static void ColorDodgeComponent(GrGLFragmentShaderBuilder* fsBuilder,
|
static void ColorDodgeComponent(GrGLFPFragmentBuilder* fsBuilder,
|
||||||
const char* final,
|
const char* final,
|
||||||
const char* src,
|
const char* src,
|
||||||
const char* dst,
|
const char* dst,
|
||||||
@ -1016,7 +1016,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Does one component of color-burn
|
// Does one component of color-burn
|
||||||
static void ColorBurnComponent(GrGLFragmentShaderBuilder* fsBuilder,
|
static void ColorBurnComponent(GrGLFPFragmentBuilder* fsBuilder,
|
||||||
const char* final,
|
const char* final,
|
||||||
const char* src,
|
const char* src,
|
||||||
const char* dst,
|
const char* dst,
|
||||||
@ -1037,7 +1037,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Does one component of soft-light. Caller should have already checked that dst alpha > 0.
|
// Does one component of soft-light. Caller should have already checked that dst alpha > 0.
|
||||||
static void SoftLightComponentPosDstAlpha(GrGLFragmentShaderBuilder* fsBuilder,
|
static void SoftLightComponentPosDstAlpha(GrGLFPFragmentBuilder* fsBuilder,
|
||||||
const char* final,
|
const char* final,
|
||||||
const char* src,
|
const char* src,
|
||||||
const char* dst,
|
const char* dst,
|
||||||
@ -1075,7 +1075,7 @@ public:
|
|||||||
// hue and saturation of the first color, the luminosity of the second color, and the input
|
// hue and saturation of the first color, the luminosity of the second color, and the input
|
||||||
// alpha. It has this signature:
|
// alpha. It has this signature:
|
||||||
// vec3 set_luminance(vec3 hueSatColor, float alpha, vec3 lumColor).
|
// vec3 set_luminance(vec3 hueSatColor, float alpha, vec3 lumColor).
|
||||||
static void AddLumFunction(GrGLFragmentShaderBuilder* fsBuilder, SkString* setLumFunction) {
|
static void AddLumFunction(GrGLFPFragmentBuilder* fsBuilder, SkString* setLumFunction) {
|
||||||
// Emit a helper that gets the luminance of a color.
|
// Emit a helper that gets the luminance of a color.
|
||||||
SkString getFunction;
|
SkString getFunction;
|
||||||
GrGLShaderVar getLumArgs[] = {
|
GrGLShaderVar getLumArgs[] = {
|
||||||
@ -1117,7 +1117,7 @@ public:
|
|||||||
// Adds a function that creates a color with the hue and luminosity of one input color and
|
// Adds a function that creates a color with the hue and luminosity of one input color and
|
||||||
// the saturation of another color. It will have this signature:
|
// the saturation of another color. It will have this signature:
|
||||||
// float set_saturation(vec3 hueLumColor, vec3 satColor)
|
// float set_saturation(vec3 hueLumColor, vec3 satColor)
|
||||||
static void AddSatFunction(GrGLFragmentShaderBuilder* fsBuilder, SkString* setSatFunction) {
|
static void AddSatFunction(GrGLFPFragmentBuilder* fsBuilder, SkString* setSatFunction) {
|
||||||
// Emit a helper that gets the saturation of a color
|
// Emit a helper that gets the saturation of a color
|
||||||
SkString getFunction;
|
SkString getFunction;
|
||||||
GrGLShaderVar getSatArgs[] = { GrGLShaderVar("color", kVec3f_GrSLType) };
|
GrGLShaderVar getSatArgs[] = { GrGLShaderVar("color", kVec3f_GrSLType) };
|
||||||
|
@ -120,7 +120,7 @@ class GrGLAlphaThresholdEffect : public GrGLFragmentProcessor {
|
|||||||
public:
|
public:
|
||||||
GrGLAlphaThresholdEffect(const GrBackendProcessorFactory&, const GrProcessor&);
|
GrGLAlphaThresholdEffect(const GrBackendProcessorFactory&, const GrProcessor&);
|
||||||
|
|
||||||
virtual void emitCode(GrGLProgramBuilder*,
|
virtual void emitCode(GrGLFPBuilder*,
|
||||||
const GrFragmentProcessor&,
|
const GrFragmentProcessor&,
|
||||||
const GrProcessorKey&,
|
const GrProcessorKey&,
|
||||||
const char* outputColor,
|
const char* outputColor,
|
||||||
@ -143,7 +143,7 @@ GrGLAlphaThresholdEffect::GrGLAlphaThresholdEffect(const GrBackendProcessorFacto
|
|||||||
: INHERITED(factory) {
|
: INHERITED(factory) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void GrGLAlphaThresholdEffect::emitCode(GrGLProgramBuilder* builder,
|
void GrGLAlphaThresholdEffect::emitCode(GrGLFPBuilder* builder,
|
||||||
const GrFragmentProcessor&,
|
const GrFragmentProcessor&,
|
||||||
const GrProcessorKey& key,
|
const GrProcessorKey& key,
|
||||||
const char* outputColor,
|
const char* outputColor,
|
||||||
@ -157,7 +157,7 @@ void GrGLAlphaThresholdEffect::emitCode(GrGLProgramBuilder* builder,
|
|||||||
GrGLProgramBuilder::kFragment_Visibility,
|
GrGLProgramBuilder::kFragment_Visibility,
|
||||||
kFloat_GrSLType, "outer_threshold");
|
kFloat_GrSLType, "outer_threshold");
|
||||||
|
|
||||||
GrGLFragmentShaderBuilder* fsBuilder = builder->getFragmentShaderBuilder();
|
GrGLFPFragmentBuilder* fsBuilder = builder->getFragmentShaderBuilder();
|
||||||
SkString coords2D = fsBuilder->ensureFSCoords2D(coords, 0);
|
SkString coords2D = fsBuilder->ensureFSCoords2D(coords, 0);
|
||||||
SkString maskCoords2D = fsBuilder->ensureFSCoords2D(coords, 1);
|
SkString maskCoords2D = fsBuilder->ensureFSCoords2D(coords, 1);
|
||||||
|
|
||||||
|
@ -253,7 +253,7 @@ public:
|
|||||||
GrGLArithmeticEffect(const GrBackendProcessorFactory&, const GrProcessor&);
|
GrGLArithmeticEffect(const GrBackendProcessorFactory&, const GrProcessor&);
|
||||||
virtual ~GrGLArithmeticEffect();
|
virtual ~GrGLArithmeticEffect();
|
||||||
|
|
||||||
virtual void emitCode(GrGLProgramBuilder*,
|
virtual void emitCode(GrGLFPBuilder*,
|
||||||
const GrFragmentProcessor&,
|
const GrFragmentProcessor&,
|
||||||
const GrProcessorKey&,
|
const GrProcessorKey&,
|
||||||
const char* outputColor,
|
const char* outputColor,
|
||||||
@ -361,7 +361,7 @@ GrGLArithmeticEffect::GrGLArithmeticEffect(const GrBackendProcessorFactory& fact
|
|||||||
GrGLArithmeticEffect::~GrGLArithmeticEffect() {
|
GrGLArithmeticEffect::~GrGLArithmeticEffect() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void GrGLArithmeticEffect::emitCode(GrGLProgramBuilder* builder,
|
void GrGLArithmeticEffect::emitCode(GrGLFPBuilder* builder,
|
||||||
const GrFragmentProcessor& fp,
|
const GrFragmentProcessor& fp,
|
||||||
const GrProcessorKey& key,
|
const GrProcessorKey& key,
|
||||||
const char* outputColor,
|
const char* outputColor,
|
||||||
@ -370,7 +370,7 @@ void GrGLArithmeticEffect::emitCode(GrGLProgramBuilder* builder,
|
|||||||
const TextureSamplerArray& samplers) {
|
const TextureSamplerArray& samplers) {
|
||||||
|
|
||||||
GrTexture* backgroundTex = fp.cast<GrArithmeticEffect>().backgroundTexture();
|
GrTexture* backgroundTex = fp.cast<GrArithmeticEffect>().backgroundTexture();
|
||||||
GrGLFragmentShaderBuilder* fsBuilder = builder->getFragmentShaderBuilder();
|
GrGLFPFragmentBuilder* fsBuilder = builder->getFragmentShaderBuilder();
|
||||||
const char* dstColor;
|
const char* dstColor;
|
||||||
if (backgroundTex) {
|
if (backgroundTex) {
|
||||||
fsBuilder->codeAppend("\t\tvec4 bgColor = ");
|
fsBuilder->codeAppend("\t\tvec4 bgColor = ");
|
||||||
|
@ -610,7 +610,7 @@ class GrGLRectBlurEffect : public GrGLFragmentProcessor {
|
|||||||
public:
|
public:
|
||||||
GrGLRectBlurEffect(const GrBackendProcessorFactory& factory,
|
GrGLRectBlurEffect(const GrBackendProcessorFactory& factory,
|
||||||
const GrProcessor&);
|
const GrProcessor&);
|
||||||
virtual void emitCode(GrGLProgramBuilder*,
|
virtual void emitCode(GrGLFPBuilder*,
|
||||||
const GrFragmentProcessor&,
|
const GrFragmentProcessor&,
|
||||||
const GrProcessorKey&,
|
const GrProcessorKey&,
|
||||||
const char* outputColor,
|
const char* outputColor,
|
||||||
@ -635,7 +635,7 @@ GrGLRectBlurEffect::GrGLRectBlurEffect(const GrBackendProcessorFactory& factory,
|
|||||||
: INHERITED(factory) {
|
: INHERITED(factory) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void OutputRectBlurProfileLookup(GrGLFragmentShaderBuilder* fsBuilder,
|
void OutputRectBlurProfileLookup(GrGLFPFragmentBuilder* fsBuilder,
|
||||||
const GrGLShaderBuilder::TextureSampler& sampler,
|
const GrGLShaderBuilder::TextureSampler& sampler,
|
||||||
const char *output,
|
const char *output,
|
||||||
const char *profileSize, const char *loc,
|
const char *profileSize, const char *loc,
|
||||||
@ -651,7 +651,7 @@ void OutputRectBlurProfileLookup(GrGLFragmentShaderBuilder* fsBuilder,
|
|||||||
fsBuilder->codeAppendf("\t\t}\n");
|
fsBuilder->codeAppendf("\t\t}\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
void GrGLRectBlurEffect::emitCode(GrGLProgramBuilder* builder,
|
void GrGLRectBlurEffect::emitCode(GrGLFPBuilder* builder,
|
||||||
const GrFragmentProcessor&,
|
const GrFragmentProcessor&,
|
||||||
const GrProcessorKey& key,
|
const GrProcessorKey& key,
|
||||||
const char* outputColor,
|
const char* outputColor,
|
||||||
@ -671,7 +671,7 @@ void GrGLRectBlurEffect::emitCode(GrGLProgramBuilder* builder,
|
|||||||
"profileSize",
|
"profileSize",
|
||||||
&profileSizeName);
|
&profileSizeName);
|
||||||
|
|
||||||
GrGLFragmentShaderBuilder* fsBuilder = builder->getFragmentShaderBuilder();
|
GrGLFPFragmentBuilder* fsBuilder = builder->getFragmentShaderBuilder();
|
||||||
const char *fragmentPos = fsBuilder->fragmentPosition();
|
const char *fragmentPos = fsBuilder->fragmentPosition();
|
||||||
|
|
||||||
if (inputColor) {
|
if (inputColor) {
|
||||||
@ -974,7 +974,7 @@ class GrGLRRectBlurEffect : public GrGLFragmentProcessor {
|
|||||||
public:
|
public:
|
||||||
GrGLRRectBlurEffect(const GrBackendProcessorFactory&, const GrProcessor&);
|
GrGLRRectBlurEffect(const GrBackendProcessorFactory&, const GrProcessor&);
|
||||||
|
|
||||||
virtual void emitCode(GrGLProgramBuilder*,
|
virtual void emitCode(GrGLFPBuilder*,
|
||||||
const GrFragmentProcessor&,
|
const GrFragmentProcessor&,
|
||||||
const GrProcessorKey&,
|
const GrProcessorKey&,
|
||||||
const char* outputColor,
|
const char* outputColor,
|
||||||
@ -996,7 +996,7 @@ GrGLRRectBlurEffect::GrGLRRectBlurEffect(const GrBackendProcessorFactory& factor
|
|||||||
: INHERITED (factory) {
|
: INHERITED (factory) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void GrGLRRectBlurEffect::emitCode(GrGLProgramBuilder* builder,
|
void GrGLRRectBlurEffect::emitCode(GrGLFPBuilder* builder,
|
||||||
const GrFragmentProcessor&,
|
const GrFragmentProcessor&,
|
||||||
const GrProcessorKey&,
|
const GrProcessorKey&,
|
||||||
const char* outputColor,
|
const char* outputColor,
|
||||||
@ -1023,7 +1023,7 @@ void GrGLRRectBlurEffect::emitCode(GrGLProgramBuilder* builder,
|
|||||||
"blurRadius",
|
"blurRadius",
|
||||||
&blurRadiusName);
|
&blurRadiusName);
|
||||||
|
|
||||||
GrGLFragmentShaderBuilder* fsBuilder = builder->getFragmentShaderBuilder();
|
GrGLFPFragmentBuilder* fsBuilder = builder->getFragmentShaderBuilder();
|
||||||
const char* fragmentPos = fsBuilder->fragmentPosition();
|
const char* fragmentPos = fsBuilder->fragmentPosition();
|
||||||
|
|
||||||
// warp the fragment position to the appropriate part of the 9patch blur texture
|
// warp the fragment position to the appropriate part of the 9patch blur texture
|
||||||
|
@ -212,7 +212,7 @@ public:
|
|||||||
GLProcessor(const GrBackendProcessorFactory& factory, const GrProcessor&);
|
GLProcessor(const GrBackendProcessorFactory& factory, const GrProcessor&);
|
||||||
virtual ~GLProcessor();
|
virtual ~GLProcessor();
|
||||||
|
|
||||||
virtual void emitCode(GrGLProgramBuilder*,
|
virtual void emitCode(GrGLFPBuilder*,
|
||||||
const GrFragmentProcessor&,
|
const GrFragmentProcessor&,
|
||||||
const GrProcessorKey&,
|
const GrProcessorKey&,
|
||||||
const char* outputColor,
|
const char* outputColor,
|
||||||
@ -278,7 +278,7 @@ GrColorProfileEffect::GLProcessor::GLProcessor(const GrBackendProcessorFactory&
|
|||||||
GrColorProfileEffect::GLProcessor::~GLProcessor() {
|
GrColorProfileEffect::GLProcessor::~GLProcessor() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void GrColorProfileEffect::GLProcessor::emitCode(GrGLProgramBuilder* builder,
|
void GrColorProfileEffect::GLProcessor::emitCode(GrGLFPBuilder* builder,
|
||||||
const GrFragmentProcessor&,
|
const GrFragmentProcessor&,
|
||||||
const GrProcessorKey&,
|
const GrProcessorKey&,
|
||||||
const char* outputColor,
|
const char* outputColor,
|
||||||
@ -305,7 +305,7 @@ void GrColorProfileEffect::GLProcessor::emitCode(GrGLProgramBuilder* builder,
|
|||||||
// Note: if implemented using texture3D in OpenGL ES older than OpenGL ES 3.0,
|
// Note: if implemented using texture3D in OpenGL ES older than OpenGL ES 3.0,
|
||||||
// the shader might need "#extension GL_OES_texture_3D : enable".
|
// the shader might need "#extension GL_OES_texture_3D : enable".
|
||||||
|
|
||||||
GrGLFragmentShaderBuilder* fsBuilder = builder->getFragmentShaderBuilder();
|
GrGLFPFragmentBuilder* fsBuilder = builder->getFragmentShaderBuilder();
|
||||||
|
|
||||||
// Unpremultiply color
|
// Unpremultiply color
|
||||||
fsBuilder->codeAppendf("\tfloat %s = max(%s.a, 0.00001);\n", nonZeroAlpha, inputColor);
|
fsBuilder->codeAppendf("\tfloat %s = max(%s.a, 0.00001);\n", nonZeroAlpha, inputColor);
|
||||||
|
@ -220,7 +220,7 @@ public:
|
|||||||
: INHERITED(factory) {
|
: INHERITED(factory) {
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void emitCode(GrGLProgramBuilder* builder,
|
virtual void emitCode(GrGLFPBuilder* builder,
|
||||||
const GrFragmentProcessor& fp,
|
const GrFragmentProcessor& fp,
|
||||||
const GrProcessorKey&,
|
const GrProcessorKey&,
|
||||||
const char* outputColor,
|
const char* outputColor,
|
||||||
|
@ -361,7 +361,7 @@ public:
|
|||||||
: INHERITED(factory) {
|
: INHERITED(factory) {
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void emitCode(GrGLProgramBuilder* builder,
|
virtual void emitCode(GrGLFPBuilder* builder,
|
||||||
const GrFragmentProcessor&,
|
const GrFragmentProcessor&,
|
||||||
const GrProcessorKey&,
|
const GrProcessorKey&,
|
||||||
const char* outputColor,
|
const char* outputColor,
|
||||||
@ -379,7 +379,7 @@ public:
|
|||||||
// could optimize this case, but we aren't for now.
|
// could optimize this case, but we aren't for now.
|
||||||
inputColor = "vec4(1)";
|
inputColor = "vec4(1)";
|
||||||
}
|
}
|
||||||
GrGLFragmentShaderBuilder* fsBuilder = builder->getFragmentShaderBuilder();
|
GrGLFPFragmentBuilder* fsBuilder = builder->getFragmentShaderBuilder();
|
||||||
// The max() is to guard against 0 / 0 during unpremul when the incoming color is
|
// The max() is to guard against 0 / 0 during unpremul when the incoming color is
|
||||||
// transparent black.
|
// transparent black.
|
||||||
fsBuilder->codeAppendf("\tfloat nonZeroAlpha = max(%s.a, 0.00001);\n", inputColor);
|
fsBuilder->codeAppendf("\tfloat nonZeroAlpha = max(%s.a, 0.00001);\n", inputColor);
|
||||||
|
@ -303,7 +303,7 @@ public:
|
|||||||
const GrProcessor&);
|
const GrProcessor&);
|
||||||
virtual ~GrGLDisplacementMapEffect();
|
virtual ~GrGLDisplacementMapEffect();
|
||||||
|
|
||||||
virtual void emitCode(GrGLProgramBuilder*,
|
virtual void emitCode(GrGLFPBuilder*,
|
||||||
const GrFragmentProcessor&,
|
const GrFragmentProcessor&,
|
||||||
const GrProcessorKey&,
|
const GrProcessorKey&,
|
||||||
const char* outputColor,
|
const char* outputColor,
|
||||||
@ -540,7 +540,7 @@ GrGLDisplacementMapEffect::GrGLDisplacementMapEffect(const GrBackendProcessorFac
|
|||||||
GrGLDisplacementMapEffect::~GrGLDisplacementMapEffect() {
|
GrGLDisplacementMapEffect::~GrGLDisplacementMapEffect() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void GrGLDisplacementMapEffect::emitCode(GrGLProgramBuilder* builder,
|
void GrGLDisplacementMapEffect::emitCode(GrGLFPBuilder* builder,
|
||||||
const GrFragmentProcessor&,
|
const GrFragmentProcessor&,
|
||||||
const GrProcessorKey& key,
|
const GrProcessorKey& key,
|
||||||
const char* outputColor,
|
const char* outputColor,
|
||||||
@ -559,7 +559,7 @@ void GrGLDisplacementMapEffect::emitCode(GrGLProgramBuilder* builder,
|
|||||||
// a number smaller than that to approximate 0, but
|
// a number smaller than that to approximate 0, but
|
||||||
// leave room for 32-bit float GPU rounding errors.
|
// leave room for 32-bit float GPU rounding errors.
|
||||||
|
|
||||||
GrGLFragmentShaderBuilder* fsBuilder = builder->getFragmentShaderBuilder();
|
GrGLFPFragmentBuilder* fsBuilder = builder->getFragmentShaderBuilder();
|
||||||
fsBuilder->codeAppendf("\t\tvec4 %s = ", dColor);
|
fsBuilder->codeAppendf("\t\tvec4 %s = ", dColor);
|
||||||
fsBuilder->appendTextureLookup(samplers[0], coords[0].c_str(), coords[0].getType());
|
fsBuilder->appendTextureLookup(samplers[0], coords[0].c_str(), coords[0].getType());
|
||||||
fsBuilder->codeAppend(";\n");
|
fsBuilder->codeAppend(";\n");
|
||||||
|
@ -450,7 +450,7 @@ public:
|
|||||||
* This is called by GrGLLightingEffect::emitCode() before either of the two virtual functions
|
* This is called by GrGLLightingEffect::emitCode() before either of the two virtual functions
|
||||||
* below. It adds a vec3f uniform visible in the FS that represents the constant light color.
|
* below. It adds a vec3f uniform visible in the FS that represents the constant light color.
|
||||||
*/
|
*/
|
||||||
void emitLightColorUniform(GrGLProgramBuilder*);
|
void emitLightColorUniform(GrGLFPBuilder*);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* These two functions are called from GrGLLightingEffect's emitCode() function.
|
* These two functions are called from GrGLLightingEffect's emitCode() function.
|
||||||
@ -460,8 +460,8 @@ public:
|
|||||||
* the FS. The default of emitLightColor appends the name of the constant light color uniform
|
* the FS. The default of emitLightColor appends the name of the constant light color uniform
|
||||||
* and so this function only needs to be overridden if the light color varies spatially.
|
* and so this function only needs to be overridden if the light color varies spatially.
|
||||||
*/
|
*/
|
||||||
virtual void emitSurfaceToLight(GrGLProgramBuilder*, const char* z) = 0;
|
virtual void emitSurfaceToLight(GrGLFPBuilder*, const char* z) = 0;
|
||||||
virtual void emitLightColor(GrGLProgramBuilder*, const char *surfaceToLight);
|
virtual void emitLightColor(GrGLFPBuilder*, const char *surfaceToLight);
|
||||||
|
|
||||||
// This is called from GrGLLightingEffect's setData(). Subclasses of GrGLLight must call
|
// This is called from GrGLLightingEffect's setData(). Subclasses of GrGLLight must call
|
||||||
// INHERITED::setData().
|
// INHERITED::setData().
|
||||||
@ -488,7 +488,7 @@ public:
|
|||||||
virtual ~GrGLDistantLight() {}
|
virtual ~GrGLDistantLight() {}
|
||||||
virtual void setData(const GrGLProgramDataManager&,
|
virtual void setData(const GrGLProgramDataManager&,
|
||||||
const SkLight* light) const SK_OVERRIDE;
|
const SkLight* light) const SK_OVERRIDE;
|
||||||
virtual void emitSurfaceToLight(GrGLProgramBuilder*, const char* z) SK_OVERRIDE;
|
virtual void emitSurfaceToLight(GrGLFPBuilder*, const char* z) SK_OVERRIDE;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
typedef GrGLLight INHERITED;
|
typedef GrGLLight INHERITED;
|
||||||
@ -502,7 +502,7 @@ public:
|
|||||||
virtual ~GrGLPointLight() {}
|
virtual ~GrGLPointLight() {}
|
||||||
virtual void setData(const GrGLProgramDataManager&,
|
virtual void setData(const GrGLProgramDataManager&,
|
||||||
const SkLight* light) const SK_OVERRIDE;
|
const SkLight* light) const SK_OVERRIDE;
|
||||||
virtual void emitSurfaceToLight(GrGLProgramBuilder*, const char* z) SK_OVERRIDE;
|
virtual void emitSurfaceToLight(GrGLFPBuilder*, const char* z) SK_OVERRIDE;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
typedef GrGLLight INHERITED;
|
typedef GrGLLight INHERITED;
|
||||||
@ -516,8 +516,8 @@ public:
|
|||||||
virtual ~GrGLSpotLight() {}
|
virtual ~GrGLSpotLight() {}
|
||||||
virtual void setData(const GrGLProgramDataManager&,
|
virtual void setData(const GrGLProgramDataManager&,
|
||||||
const SkLight* light) const SK_OVERRIDE;
|
const SkLight* light) const SK_OVERRIDE;
|
||||||
virtual void emitSurfaceToLight(GrGLProgramBuilder*, const char* z) SK_OVERRIDE;
|
virtual void emitSurfaceToLight(GrGLFPBuilder*, const char* z) SK_OVERRIDE;
|
||||||
virtual void emitLightColor(GrGLProgramBuilder*, const char *surfaceToLight) SK_OVERRIDE;
|
virtual void emitLightColor(GrGLFPBuilder*, const char *surfaceToLight) SK_OVERRIDE;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
typedef GrGLLight INHERITED;
|
typedef GrGLLight INHERITED;
|
||||||
@ -1228,7 +1228,7 @@ public:
|
|||||||
GrGLLightingEffect(const GrBackendProcessorFactory&, const GrProcessor&);
|
GrGLLightingEffect(const GrBackendProcessorFactory&, const GrProcessor&);
|
||||||
virtual ~GrGLLightingEffect();
|
virtual ~GrGLLightingEffect();
|
||||||
|
|
||||||
virtual void emitCode(GrGLProgramBuilder*,
|
virtual void emitCode(GrGLFPBuilder*,
|
||||||
const GrFragmentProcessor&,
|
const GrFragmentProcessor&,
|
||||||
const GrProcessorKey&,
|
const GrProcessorKey&,
|
||||||
const char* outputColor,
|
const char* outputColor,
|
||||||
@ -1244,7 +1244,7 @@ public:
|
|||||||
virtual void setData(const GrGLProgramDataManager&, const GrProcessor&) SK_OVERRIDE;
|
virtual void setData(const GrGLProgramDataManager&, const GrProcessor&) SK_OVERRIDE;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void emitLightFunc(GrGLProgramBuilder*, SkString* funcName) = 0;
|
virtual void emitLightFunc(GrGLFPBuilder*, SkString* funcName) = 0;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
typedef GrGLFragmentProcessor INHERITED;
|
typedef GrGLFragmentProcessor INHERITED;
|
||||||
@ -1259,7 +1259,7 @@ private:
|
|||||||
class GrGLDiffuseLightingEffect : public GrGLLightingEffect {
|
class GrGLDiffuseLightingEffect : public GrGLLightingEffect {
|
||||||
public:
|
public:
|
||||||
GrGLDiffuseLightingEffect(const GrBackendProcessorFactory&, const GrProcessor&);
|
GrGLDiffuseLightingEffect(const GrBackendProcessorFactory&, const GrProcessor&);
|
||||||
virtual void emitLightFunc(GrGLProgramBuilder*, SkString* funcName) SK_OVERRIDE;
|
virtual void emitLightFunc(GrGLFPBuilder*, SkString* funcName) SK_OVERRIDE;
|
||||||
virtual void setData(const GrGLProgramDataManager&, const GrProcessor&) SK_OVERRIDE;
|
virtual void setData(const GrGLProgramDataManager&, const GrProcessor&) SK_OVERRIDE;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -1273,7 +1273,7 @@ private:
|
|||||||
class GrGLSpecularLightingEffect : public GrGLLightingEffect {
|
class GrGLSpecularLightingEffect : public GrGLLightingEffect {
|
||||||
public:
|
public:
|
||||||
GrGLSpecularLightingEffect(const GrBackendProcessorFactory&, const GrProcessor&);
|
GrGLSpecularLightingEffect(const GrBackendProcessorFactory&, const GrProcessor&);
|
||||||
virtual void emitLightFunc(GrGLProgramBuilder*, SkString* funcName) SK_OVERRIDE;
|
virtual void emitLightFunc(GrGLFPBuilder*, SkString* funcName) SK_OVERRIDE;
|
||||||
virtual void setData(const GrGLProgramDataManager&, const GrProcessor&) SK_OVERRIDE;
|
virtual void setData(const GrGLProgramDataManager&, const GrProcessor&) SK_OVERRIDE;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -1361,7 +1361,7 @@ GrGLLightingEffect::~GrGLLightingEffect() {
|
|||||||
delete fLight;
|
delete fLight;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GrGLLightingEffect::emitCode(GrGLProgramBuilder* builder,
|
void GrGLLightingEffect::emitCode(GrGLFPBuilder* builder,
|
||||||
const GrFragmentProcessor&,
|
const GrFragmentProcessor&,
|
||||||
const GrProcessorKey& key,
|
const GrProcessorKey& key,
|
||||||
const char* outputColor,
|
const char* outputColor,
|
||||||
@ -1387,7 +1387,7 @@ void GrGLLightingEffect::emitCode(GrGLProgramBuilder* builder,
|
|||||||
GrGLShaderVar("scale", kFloat_GrSLType),
|
GrGLShaderVar("scale", kFloat_GrSLType),
|
||||||
};
|
};
|
||||||
SkString sobelFuncName;
|
SkString sobelFuncName;
|
||||||
GrGLFragmentShaderBuilder* fsBuilder = builder->getFragmentShaderBuilder();
|
GrGLFPFragmentBuilder* fsBuilder = builder->getFragmentShaderBuilder();
|
||||||
SkString coords2D = fsBuilder->ensureFSCoords2D(coords, 0);
|
SkString coords2D = fsBuilder->ensureFSCoords2D(coords, 0);
|
||||||
|
|
||||||
fsBuilder->emitFunction(kFloat_GrSLType,
|
fsBuilder->emitFunction(kFloat_GrSLType,
|
||||||
@ -1483,7 +1483,7 @@ GrGLDiffuseLightingEffect::GrGLDiffuseLightingEffect(const GrBackendProcessorFac
|
|||||||
: INHERITED(factory, proc) {
|
: INHERITED(factory, proc) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void GrGLDiffuseLightingEffect::emitLightFunc(GrGLProgramBuilder* builder, SkString* funcName) {
|
void GrGLDiffuseLightingEffect::emitLightFunc(GrGLFPBuilder* builder, SkString* funcName) {
|
||||||
const char* kd;
|
const char* kd;
|
||||||
fKDUni = builder->addUniform(GrGLProgramBuilder::kFragment_Visibility,
|
fKDUni = builder->addUniform(GrGLProgramBuilder::kFragment_Visibility,
|
||||||
kFloat_GrSLType,
|
kFloat_GrSLType,
|
||||||
@ -1562,7 +1562,7 @@ GrGLSpecularLightingEffect::GrGLSpecularLightingEffect(const GrBackendProcessorF
|
|||||||
: INHERITED(factory, proc) {
|
: INHERITED(factory, proc) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void GrGLSpecularLightingEffect::emitLightFunc(GrGLProgramBuilder* builder, SkString* funcName) {
|
void GrGLSpecularLightingEffect::emitLightFunc(GrGLFPBuilder* builder, SkString* funcName) {
|
||||||
const char* ks;
|
const char* ks;
|
||||||
const char* shininess;
|
const char* shininess;
|
||||||
|
|
||||||
@ -1598,12 +1598,12 @@ void GrGLSpecularLightingEffect::setData(const GrGLProgramDataManager& pdman,
|
|||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
void GrGLLight::emitLightColorUniform(GrGLProgramBuilder* builder) {
|
void GrGLLight::emitLightColorUniform(GrGLFPBuilder* builder) {
|
||||||
fColorUni = builder->addUniform(GrGLProgramBuilder::kFragment_Visibility,
|
fColorUni = builder->addUniform(GrGLProgramBuilder::kFragment_Visibility,
|
||||||
kVec3f_GrSLType, "LightColor");
|
kVec3f_GrSLType, "LightColor");
|
||||||
}
|
}
|
||||||
|
|
||||||
void GrGLLight::emitLightColor(GrGLProgramBuilder* builder,
|
void GrGLLight::emitLightColor(GrGLFPBuilder* builder,
|
||||||
const char *surfaceToLight) {
|
const char *surfaceToLight) {
|
||||||
builder->getFragmentShaderBuilder()->codeAppend(builder->getUniformCStr(this->lightColorUni()));
|
builder->getFragmentShaderBuilder()->codeAppend(builder->getUniformCStr(this->lightColorUni()));
|
||||||
}
|
}
|
||||||
@ -1623,7 +1623,7 @@ void GrGLDistantLight::setData(const GrGLProgramDataManager& pdman,
|
|||||||
setUniformNormal3(pdman, fDirectionUni, distantLight->direction());
|
setUniformNormal3(pdman, fDirectionUni, distantLight->direction());
|
||||||
}
|
}
|
||||||
|
|
||||||
void GrGLDistantLight::emitSurfaceToLight(GrGLProgramBuilder* builder, const char* z) {
|
void GrGLDistantLight::emitSurfaceToLight(GrGLFPBuilder* builder, const char* z) {
|
||||||
const char* dir;
|
const char* dir;
|
||||||
fDirectionUni = builder->addUniform(GrGLProgramBuilder::kFragment_Visibility, kVec3f_GrSLType,
|
fDirectionUni = builder->addUniform(GrGLProgramBuilder::kFragment_Visibility, kVec3f_GrSLType,
|
||||||
"LightDirection", &dir);
|
"LightDirection", &dir);
|
||||||
@ -1640,11 +1640,11 @@ void GrGLPointLight::setData(const GrGLProgramDataManager& pdman,
|
|||||||
setUniformPoint3(pdman, fLocationUni, pointLight->location());
|
setUniformPoint3(pdman, fLocationUni, pointLight->location());
|
||||||
}
|
}
|
||||||
|
|
||||||
void GrGLPointLight::emitSurfaceToLight(GrGLProgramBuilder* builder, const char* z) {
|
void GrGLPointLight::emitSurfaceToLight(GrGLFPBuilder* builder, const char* z) {
|
||||||
const char* loc;
|
const char* loc;
|
||||||
fLocationUni = builder->addUniform(GrGLProgramBuilder::kFragment_Visibility, kVec3f_GrSLType,
|
fLocationUni = builder->addUniform(GrGLProgramBuilder::kFragment_Visibility, kVec3f_GrSLType,
|
||||||
"LightLocation", &loc);
|
"LightLocation", &loc);
|
||||||
GrGLFragmentShaderBuilder* fsBuilder = builder->getFragmentShaderBuilder();
|
GrGLFPFragmentBuilder* fsBuilder = builder->getFragmentShaderBuilder();
|
||||||
fsBuilder->codeAppendf("normalize(%s - vec3(%s.xy, %s))",
|
fsBuilder->codeAppendf("normalize(%s - vec3(%s.xy, %s))",
|
||||||
loc, fsBuilder->fragmentPosition(), z);
|
loc, fsBuilder->fragmentPosition(), z);
|
||||||
}
|
}
|
||||||
@ -1664,17 +1664,17 @@ void GrGLSpotLight::setData(const GrGLProgramDataManager& pdman,
|
|||||||
setUniformNormal3(pdman, fSUni, spotLight->s());
|
setUniformNormal3(pdman, fSUni, spotLight->s());
|
||||||
}
|
}
|
||||||
|
|
||||||
void GrGLSpotLight::emitSurfaceToLight(GrGLProgramBuilder* builder, const char* z) {
|
void GrGLSpotLight::emitSurfaceToLight(GrGLFPBuilder* builder, const char* z) {
|
||||||
const char* location;
|
const char* location;
|
||||||
fLocationUni = builder->addUniform(GrGLProgramBuilder::kFragment_Visibility,
|
fLocationUni = builder->addUniform(GrGLProgramBuilder::kFragment_Visibility,
|
||||||
kVec3f_GrSLType, "LightLocation", &location);
|
kVec3f_GrSLType, "LightLocation", &location);
|
||||||
|
|
||||||
GrGLFragmentShaderBuilder* fsBuilder = builder->getFragmentShaderBuilder();
|
GrGLFPFragmentBuilder* fsBuilder = builder->getFragmentShaderBuilder();
|
||||||
fsBuilder->codeAppendf("normalize(%s - vec3(%s.xy, %s))",
|
fsBuilder->codeAppendf("normalize(%s - vec3(%s.xy, %s))",
|
||||||
location, fsBuilder->fragmentPosition(), z);
|
location, fsBuilder->fragmentPosition(), z);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GrGLSpotLight::emitLightColor(GrGLProgramBuilder* builder,
|
void GrGLSpotLight::emitLightColor(GrGLFPBuilder* builder,
|
||||||
const char *surfaceToLight) {
|
const char *surfaceToLight) {
|
||||||
|
|
||||||
const char* color = builder->getUniformCStr(this->lightColorUni()); // created by parent class.
|
const char* color = builder->getUniformCStr(this->lightColorUni()); // created by parent class.
|
||||||
@ -1709,7 +1709,7 @@ void GrGLSpotLight::emitLightColor(GrGLProgramBuilder* builder,
|
|||||||
color, cosOuter, coneScale);
|
color, cosOuter, coneScale);
|
||||||
lightColorBody.appendf("\t}\n");
|
lightColorBody.appendf("\t}\n");
|
||||||
lightColorBody.appendf("\treturn %s;\n", color);
|
lightColorBody.appendf("\treturn %s;\n", color);
|
||||||
GrGLFragmentShaderBuilder* fsBuilder = builder->getFragmentShaderBuilder();
|
GrGLFPFragmentBuilder* fsBuilder = builder->getFragmentShaderBuilder();
|
||||||
fsBuilder->emitFunction(kVec3f_GrSLType,
|
fsBuilder->emitFunction(kVec3f_GrSLType,
|
||||||
"lightColor",
|
"lightColor",
|
||||||
SK_ARRAY_COUNT(gLightColorArgs),
|
SK_ARRAY_COUNT(gLightColorArgs),
|
||||||
|
@ -82,7 +82,7 @@ public:
|
|||||||
|
|
||||||
static void GenKey(const GrProcessor&, const GrGLCaps&, GrProcessorKeyBuilder* b) {}
|
static void GenKey(const GrProcessor&, const GrGLCaps&, GrProcessorKeyBuilder* b) {}
|
||||||
|
|
||||||
virtual void emitCode(GrGLProgramBuilder* builder,
|
virtual void emitCode(GrGLFPBuilder* builder,
|
||||||
const GrFragmentProcessor&,
|
const GrFragmentProcessor&,
|
||||||
const GrProcessorKey&,
|
const GrProcessorKey&,
|
||||||
const char* outputColor,
|
const char* outputColor,
|
||||||
@ -93,7 +93,7 @@ public:
|
|||||||
inputColor = "vec4(1)";
|
inputColor = "vec4(1)";
|
||||||
}
|
}
|
||||||
|
|
||||||
GrGLFragmentShaderBuilder* fsBuilder = builder->getFragmentShaderBuilder();
|
GrGLFPFragmentBuilder* fsBuilder = builder->getFragmentShaderBuilder();
|
||||||
fsBuilder->codeAppendf("\tfloat luma = dot(vec3(%f, %f, %f), %s.rgb);\n",
|
fsBuilder->codeAppendf("\tfloat luma = dot(vec3(%f, %f, %f), %s.rgb);\n",
|
||||||
SK_ITU_BT709_LUM_COEFF_R,
|
SK_ITU_BT709_LUM_COEFF_R,
|
||||||
SK_ITU_BT709_LUM_COEFF_G,
|
SK_ITU_BT709_LUM_COEFF_G,
|
||||||
|
@ -95,7 +95,7 @@ class GrGLMagnifierEffect : public GrGLFragmentProcessor {
|
|||||||
public:
|
public:
|
||||||
GrGLMagnifierEffect(const GrBackendProcessorFactory&, const GrProcessor&);
|
GrGLMagnifierEffect(const GrBackendProcessorFactory&, const GrProcessor&);
|
||||||
|
|
||||||
virtual void emitCode(GrGLProgramBuilder*,
|
virtual void emitCode(GrGLFPBuilder*,
|
||||||
const GrFragmentProcessor&,
|
const GrFragmentProcessor&,
|
||||||
const GrProcessorKey&,
|
const GrProcessorKey&,
|
||||||
const char* outputColor,
|
const char* outputColor,
|
||||||
@ -118,7 +118,7 @@ GrGLMagnifierEffect::GrGLMagnifierEffect(const GrBackendProcessorFactory& factor
|
|||||||
: INHERITED(factory) {
|
: INHERITED(factory) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void GrGLMagnifierEffect::emitCode(GrGLProgramBuilder* builder,
|
void GrGLMagnifierEffect::emitCode(GrGLFPBuilder* builder,
|
||||||
const GrFragmentProcessor&,
|
const GrFragmentProcessor&,
|
||||||
const GrProcessorKey& key,
|
const GrProcessorKey& key,
|
||||||
const char* outputColor,
|
const char* outputColor,
|
||||||
@ -138,7 +138,7 @@ void GrGLMagnifierEffect::emitCode(GrGLProgramBuilder* builder,
|
|||||||
GrGLProgramBuilder::kVertex_Visibility,
|
GrGLProgramBuilder::kVertex_Visibility,
|
||||||
kVec2f_GrSLType, "InvInset");
|
kVec2f_GrSLType, "InvInset");
|
||||||
|
|
||||||
GrGLFragmentShaderBuilder* fsBuilder = builder->getFragmentShaderBuilder();
|
GrGLFPFragmentBuilder* fsBuilder = builder->getFragmentShaderBuilder();
|
||||||
SkString coords2D = fsBuilder->ensureFSCoords2D(coords, 0);
|
SkString coords2D = fsBuilder->ensureFSCoords2D(coords, 0);
|
||||||
fsBuilder->codeAppendf("\t\tvec2 coord = %s;\n", coords2D.c_str());
|
fsBuilder->codeAppendf("\t\tvec2 coord = %s;\n", coords2D.c_str());
|
||||||
fsBuilder->codeAppendf("\t\tvec2 zoom_coord = %s + %s * %s;\n",
|
fsBuilder->codeAppendf("\t\tvec2 zoom_coord = %s + %s * %s;\n",
|
||||||
|
@ -332,7 +332,7 @@ class GrGLMorphologyEffect : public GrGLFragmentProcessor {
|
|||||||
public:
|
public:
|
||||||
GrGLMorphologyEffect (const GrBackendProcessorFactory&, const GrProcessor&);
|
GrGLMorphologyEffect (const GrBackendProcessorFactory&, const GrProcessor&);
|
||||||
|
|
||||||
virtual void emitCode(GrGLProgramBuilder*,
|
virtual void emitCode(GrGLFPBuilder*,
|
||||||
const GrFragmentProcessor&,
|
const GrFragmentProcessor&,
|
||||||
const GrProcessorKey&,
|
const GrProcessorKey&,
|
||||||
const char* outputColor,
|
const char* outputColor,
|
||||||
@ -362,7 +362,7 @@ GrGLMorphologyEffect::GrGLMorphologyEffect(const GrBackendProcessorFactory& fact
|
|||||||
fType = m.type();
|
fType = m.type();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GrGLMorphologyEffect::emitCode(GrGLProgramBuilder* builder,
|
void GrGLMorphologyEffect::emitCode(GrGLFPBuilder* builder,
|
||||||
const GrFragmentProcessor&,
|
const GrFragmentProcessor&,
|
||||||
const GrProcessorKey& key,
|
const GrProcessorKey& key,
|
||||||
const char* outputColor,
|
const char* outputColor,
|
||||||
@ -372,7 +372,7 @@ void GrGLMorphologyEffect::emitCode(GrGLProgramBuilder* builder,
|
|||||||
fImageIncrementUni = builder->addUniform(GrGLProgramBuilder::kFragment_Visibility,
|
fImageIncrementUni = builder->addUniform(GrGLProgramBuilder::kFragment_Visibility,
|
||||||
kVec2f_GrSLType, "ImageIncrement");
|
kVec2f_GrSLType, "ImageIncrement");
|
||||||
|
|
||||||
GrGLFragmentShaderBuilder* fsBuilder = builder->getFragmentShaderBuilder();
|
GrGLFPFragmentBuilder* fsBuilder = builder->getFragmentShaderBuilder();
|
||||||
SkString coords2D = fsBuilder->ensureFSCoords2D(coords, 0);
|
SkString coords2D = fsBuilder->ensureFSCoords2D(coords, 0);
|
||||||
const char* func;
|
const char* func;
|
||||||
switch (fType) {
|
switch (fType) {
|
||||||
|
@ -515,7 +515,7 @@ public:
|
|||||||
const GrProcessor&);
|
const GrProcessor&);
|
||||||
virtual ~GrGLPerlinNoise() {}
|
virtual ~GrGLPerlinNoise() {}
|
||||||
|
|
||||||
virtual void emitCode(GrGLProgramBuilder*,
|
virtual void emitCode(GrGLFPBuilder*,
|
||||||
const GrFragmentProcessor&,
|
const GrFragmentProcessor&,
|
||||||
const GrProcessorKey&,
|
const GrProcessorKey&,
|
||||||
const char* outputColor,
|
const char* outputColor,
|
||||||
@ -665,7 +665,7 @@ GrGLPerlinNoise::GrGLPerlinNoise(const GrBackendProcessorFactory& factory,
|
|||||||
, fNumOctaves(processor.cast<GrPerlinNoiseEffect>().numOctaves()) {
|
, fNumOctaves(processor.cast<GrPerlinNoiseEffect>().numOctaves()) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void GrGLPerlinNoise::emitCode(GrGLProgramBuilder* builder,
|
void GrGLPerlinNoise::emitCode(GrGLFPBuilder* builder,
|
||||||
const GrFragmentProcessor&,
|
const GrFragmentProcessor&,
|
||||||
const GrProcessorKey& key,
|
const GrProcessorKey& key,
|
||||||
const char* outputColor,
|
const char* outputColor,
|
||||||
@ -674,7 +674,7 @@ void GrGLPerlinNoise::emitCode(GrGLProgramBuilder* builder,
|
|||||||
const TextureSamplerArray& samplers) {
|
const TextureSamplerArray& samplers) {
|
||||||
sk_ignore_unused_variable(inputColor);
|
sk_ignore_unused_variable(inputColor);
|
||||||
|
|
||||||
GrGLFragmentShaderBuilder* fsBuilder = builder->getFragmentShaderBuilder();
|
GrGLFPFragmentBuilder* fsBuilder = builder->getFragmentShaderBuilder();
|
||||||
SkString vCoords = fsBuilder->ensureFSCoords2D(coords, 0);
|
SkString vCoords = fsBuilder->ensureFSCoords2D(coords, 0);
|
||||||
|
|
||||||
fBaseFrequencyUni = builder->addUniform(GrGLProgramBuilder::kFragment_Visibility,
|
fBaseFrequencyUni = builder->addUniform(GrGLProgramBuilder::kFragment_Visibility,
|
||||||
|
@ -316,7 +316,7 @@ class GLColorTableEffect : public GrGLFragmentProcessor {
|
|||||||
public:
|
public:
|
||||||
GLColorTableEffect(const GrBackendProcessorFactory&, const GrProcessor&);
|
GLColorTableEffect(const GrBackendProcessorFactory&, const GrProcessor&);
|
||||||
|
|
||||||
virtual void emitCode(GrGLProgramBuilder*,
|
virtual void emitCode(GrGLFPBuilder*,
|
||||||
const GrFragmentProcessor&,
|
const GrFragmentProcessor&,
|
||||||
const GrProcessorKey&,
|
const GrProcessorKey&,
|
||||||
const char* outputColor,
|
const char* outputColor,
|
||||||
@ -337,7 +337,7 @@ GLColorTableEffect::GLColorTableEffect(const GrBackendProcessorFactory& factory,
|
|||||||
: INHERITED(factory) {
|
: INHERITED(factory) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLColorTableEffect::emitCode(GrGLProgramBuilder* builder,
|
void GLColorTableEffect::emitCode(GrGLFPBuilder* builder,
|
||||||
const GrFragmentProcessor&,
|
const GrFragmentProcessor&,
|
||||||
const GrProcessorKey&,
|
const GrProcessorKey&,
|
||||||
const char* outputColor,
|
const char* outputColor,
|
||||||
@ -347,7 +347,7 @@ void GLColorTableEffect::emitCode(GrGLProgramBuilder* builder,
|
|||||||
|
|
||||||
static const float kColorScaleFactor = 255.0f / 256.0f;
|
static const float kColorScaleFactor = 255.0f / 256.0f;
|
||||||
static const float kColorOffsetFactor = 1.0f / 512.0f;
|
static const float kColorOffsetFactor = 1.0f / 512.0f;
|
||||||
GrGLFragmentShaderBuilder* fsBuilder = builder->getFragmentShaderBuilder();
|
GrGLFPFragmentBuilder* fsBuilder = builder->getFragmentShaderBuilder();
|
||||||
if (NULL == inputColor) {
|
if (NULL == inputColor) {
|
||||||
// the input color is solid white (all ones).
|
// the input color is solid white (all ones).
|
||||||
static const float kMaxValue = kColorScaleFactor + kColorOffsetFactor;
|
static const float kMaxValue = kColorScaleFactor + kColorOffsetFactor;
|
||||||
|
@ -956,7 +956,7 @@ GrGLGradientEffect::GrGLGradientEffect(const GrBackendProcessorFactory& factory)
|
|||||||
|
|
||||||
GrGLGradientEffect::~GrGLGradientEffect() { }
|
GrGLGradientEffect::~GrGLGradientEffect() { }
|
||||||
|
|
||||||
void GrGLGradientEffect::emitUniforms(GrGLProgramBuilder* builder, uint32_t baseKey) {
|
void GrGLGradientEffect::emitUniforms(GrGLFPBuilder* builder, uint32_t baseKey) {
|
||||||
|
|
||||||
if (SkGradientShaderBase::kTwo_GpuColorType == ColorTypeFromKey(baseKey)) { // 2 Color case
|
if (SkGradientShaderBase::kTwo_GpuColorType == ColorTypeFromKey(baseKey)) { // 2 Color case
|
||||||
fColorStartUni = builder->addUniform(GrGLProgramBuilder::kFragment_Visibility,
|
fColorStartUni = builder->addUniform(GrGLProgramBuilder::kFragment_Visibility,
|
||||||
@ -1056,13 +1056,13 @@ uint32_t GrGLGradientEffect::GenBaseGradientKey(const GrProcessor& processor) {
|
|||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GrGLGradientEffect::emitColor(GrGLProgramBuilder* builder,
|
void GrGLGradientEffect::emitColor(GrGLFPBuilder* builder,
|
||||||
const char* gradientTValue,
|
const char* gradientTValue,
|
||||||
uint32_t baseKey,
|
uint32_t baseKey,
|
||||||
const char* outputColor,
|
const char* outputColor,
|
||||||
const char* inputColor,
|
const char* inputColor,
|
||||||
const TextureSamplerArray& samplers) {
|
const TextureSamplerArray& samplers) {
|
||||||
GrGLFragmentShaderBuilder* fsBuilder = builder->getFragmentShaderBuilder();
|
GrGLFPFragmentBuilder* fsBuilder = builder->getFragmentShaderBuilder();
|
||||||
if (SkGradientShaderBase::kTwo_GpuColorType == ColorTypeFromKey(baseKey)){
|
if (SkGradientShaderBase::kTwo_GpuColorType == ColorTypeFromKey(baseKey)){
|
||||||
fsBuilder->codeAppendf("\tvec4 colorTemp = mix(%s, %s, clamp(%s, 0.0, 1.0));\n",
|
fsBuilder->codeAppendf("\tvec4 colorTemp = mix(%s, %s, clamp(%s, 0.0, 1.0));\n",
|
||||||
builder->getUniformVariable(fColorStartUni).c_str(),
|
builder->getUniformVariable(fColorStartUni).c_str(),
|
||||||
|
@ -415,13 +415,13 @@ protected:
|
|||||||
|
|
||||||
// Emits the uniform used as the y-coord to texture samples in derived classes. Subclasses
|
// Emits the uniform used as the y-coord to texture samples in derived classes. Subclasses
|
||||||
// should call this method from their emitCode().
|
// should call this method from their emitCode().
|
||||||
void emitUniforms(GrGLProgramBuilder* builder, uint32_t baseKey);
|
void emitUniforms(GrGLFPBuilder* builder, uint32_t baseKey);
|
||||||
|
|
||||||
|
|
||||||
// emit code that gets a fragment's color from an expression for t; Has branches for 3 separate
|
// emit code that gets a fragment's color from an expression for t; Has branches for 3 separate
|
||||||
// control flows inside -- 2 color gradients, 3 color symmetric gradients (both using
|
// control flows inside -- 2 color gradients, 3 color symmetric gradients (both using
|
||||||
// native GLSL mix), and 4+ color gradients that use the traditional texture lookup.
|
// native GLSL mix), and 4+ color gradients that use the traditional texture lookup.
|
||||||
void emitColor(GrGLProgramBuilder* builder,
|
void emitColor(GrGLFPBuilder* builder,
|
||||||
const char* gradientTValue,
|
const char* gradientTValue,
|
||||||
uint32_t baseKey,
|
uint32_t baseKey,
|
||||||
const char* outputColor,
|
const char* outputColor,
|
||||||
|
@ -473,7 +473,7 @@ public:
|
|||||||
|
|
||||||
virtual ~GrGLLinearGradient() { }
|
virtual ~GrGLLinearGradient() { }
|
||||||
|
|
||||||
virtual void emitCode(GrGLProgramBuilder*,
|
virtual void emitCode(GrGLFPBuilder*,
|
||||||
const GrFragmentProcessor&,
|
const GrFragmentProcessor&,
|
||||||
const GrProcessorKey&,
|
const GrProcessorKey&,
|
||||||
const char* outputColor,
|
const char* outputColor,
|
||||||
@ -550,7 +550,7 @@ GrFragmentProcessor* GrLinearGradient::TestCreate(SkRandom* random,
|
|||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
void GrGLLinearGradient::emitCode(GrGLProgramBuilder* builder,
|
void GrGLLinearGradient::emitCode(GrGLFPBuilder* builder,
|
||||||
const GrFragmentProcessor&,
|
const GrFragmentProcessor&,
|
||||||
const GrProcessorKey& key,
|
const GrProcessorKey& key,
|
||||||
const char* outputColor,
|
const char* outputColor,
|
||||||
|
@ -480,7 +480,7 @@ public:
|
|||||||
const GrProcessor&) : INHERITED (factory) { }
|
const GrProcessor&) : INHERITED (factory) { }
|
||||||
virtual ~GrGLRadialGradient() { }
|
virtual ~GrGLRadialGradient() { }
|
||||||
|
|
||||||
virtual void emitCode(GrGLProgramBuilder*,
|
virtual void emitCode(GrGLFPBuilder*,
|
||||||
const GrFragmentProcessor&,
|
const GrFragmentProcessor&,
|
||||||
const GrProcessorKey&,
|
const GrProcessorKey&,
|
||||||
const char* outputColor,
|
const char* outputColor,
|
||||||
@ -559,7 +559,7 @@ GrFragmentProcessor* GrRadialGradient::TestCreate(SkRandom* random,
|
|||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
void GrGLRadialGradient::emitCode(GrGLProgramBuilder* builder,
|
void GrGLRadialGradient::emitCode(GrGLFPBuilder* builder,
|
||||||
const GrFragmentProcessor&,
|
const GrFragmentProcessor&,
|
||||||
const GrProcessorKey& key,
|
const GrProcessorKey& key,
|
||||||
const char* outputColor,
|
const char* outputColor,
|
||||||
|
@ -195,7 +195,7 @@ public:
|
|||||||
const GrProcessor&) : INHERITED (factory) { }
|
const GrProcessor&) : INHERITED (factory) { }
|
||||||
virtual ~GrGLSweepGradient() { }
|
virtual ~GrGLSweepGradient() { }
|
||||||
|
|
||||||
virtual void emitCode(GrGLProgramBuilder*,
|
virtual void emitCode(GrGLFPBuilder*,
|
||||||
const GrFragmentProcessor&,
|
const GrFragmentProcessor&,
|
||||||
const GrProcessorKey&,
|
const GrProcessorKey&,
|
||||||
const char* outputColor,
|
const char* outputColor,
|
||||||
@ -266,7 +266,7 @@ GrFragmentProcessor* GrSweepGradient::TestCreate(SkRandom* random,
|
|||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
void GrGLSweepGradient::emitCode(GrGLProgramBuilder* builder,
|
void GrGLSweepGradient::emitCode(GrGLFPBuilder* builder,
|
||||||
const GrFragmentProcessor&,
|
const GrFragmentProcessor&,
|
||||||
const GrProcessorKey& key,
|
const GrProcessorKey& key,
|
||||||
const char* outputColor,
|
const char* outputColor,
|
||||||
|
@ -140,7 +140,7 @@ public:
|
|||||||
GLEdge2PtConicalEffect(const GrBackendProcessorFactory& factory, const GrProcessor&);
|
GLEdge2PtConicalEffect(const GrBackendProcessorFactory& factory, const GrProcessor&);
|
||||||
virtual ~GLEdge2PtConicalEffect() { }
|
virtual ~GLEdge2PtConicalEffect() { }
|
||||||
|
|
||||||
virtual void emitCode(GrGLProgramBuilder*,
|
virtual void emitCode(GrGLFPBuilder*,
|
||||||
const GrFragmentProcessor&,
|
const GrFragmentProcessor&,
|
||||||
const GrProcessorKey&,
|
const GrProcessorKey&,
|
||||||
const char* outputColor,
|
const char* outputColor,
|
||||||
@ -223,7 +223,7 @@ GLEdge2PtConicalEffect::GLEdge2PtConicalEffect(const GrBackendProcessorFactory&
|
|||||||
, fCachedRadius(-SK_ScalarMax)
|
, fCachedRadius(-SK_ScalarMax)
|
||||||
, fCachedDiffRadius(-SK_ScalarMax) {}
|
, fCachedDiffRadius(-SK_ScalarMax) {}
|
||||||
|
|
||||||
void GLEdge2PtConicalEffect::emitCode(GrGLProgramBuilder* builder,
|
void GLEdge2PtConicalEffect::emitCode(GrGLFPBuilder* builder,
|
||||||
const GrFragmentProcessor&,
|
const GrFragmentProcessor&,
|
||||||
const GrProcessorKey& key,
|
const GrProcessorKey& key,
|
||||||
const char* outputColor,
|
const char* outputColor,
|
||||||
@ -249,7 +249,7 @@ void GLEdge2PtConicalEffect::emitCode(GrGLProgramBuilder* builder,
|
|||||||
SkASSERT(coords[0].getType() == coords[1].getType());
|
SkASSERT(coords[0].getType() == coords[1].getType());
|
||||||
const char* coords2D;
|
const char* coords2D;
|
||||||
SkString bVar;
|
SkString bVar;
|
||||||
GrGLFragmentShaderBuilder* fsBuilder = builder->getFragmentShaderBuilder();
|
GrGLFPFragmentBuilder* fsBuilder = builder->getFragmentShaderBuilder();
|
||||||
if (kVec3f_GrSLType == coords[0].getType()) {
|
if (kVec3f_GrSLType == coords[0].getType()) {
|
||||||
fsBuilder->codeAppendf("\tvec3 interpolants = vec3(%s.xy / %s.z, %s.x / %s.z);\n",
|
fsBuilder->codeAppendf("\tvec3 interpolants = vec3(%s.xy / %s.z, %s.x / %s.z);\n",
|
||||||
coords[0].c_str(), coords[0].c_str(), coords[1].c_str(),
|
coords[0].c_str(), coords[0].c_str(), coords[1].c_str(),
|
||||||
@ -421,7 +421,7 @@ public:
|
|||||||
GLFocalOutside2PtConicalEffect(const GrBackendProcessorFactory& factory, const GrProcessor&);
|
GLFocalOutside2PtConicalEffect(const GrBackendProcessorFactory& factory, const GrProcessor&);
|
||||||
virtual ~GLFocalOutside2PtConicalEffect() { }
|
virtual ~GLFocalOutside2PtConicalEffect() { }
|
||||||
|
|
||||||
virtual void emitCode(GrGLProgramBuilder*,
|
virtual void emitCode(GrGLFPBuilder*,
|
||||||
const GrFragmentProcessor&,
|
const GrFragmentProcessor&,
|
||||||
const GrProcessorKey&,
|
const GrProcessorKey&,
|
||||||
const char* outputColor,
|
const char* outputColor,
|
||||||
@ -504,7 +504,7 @@ GLFocalOutside2PtConicalEffect::GLFocalOutside2PtConicalEffect(const GrBackendPr
|
|||||||
fIsFlipped = data.isFlipped();
|
fIsFlipped = data.isFlipped();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLFocalOutside2PtConicalEffect::emitCode(GrGLProgramBuilder* builder,
|
void GLFocalOutside2PtConicalEffect::emitCode(GrGLFPBuilder* builder,
|
||||||
const GrFragmentProcessor&,
|
const GrFragmentProcessor&,
|
||||||
const GrProcessorKey& key,
|
const GrProcessorKey& key,
|
||||||
const char* outputColor,
|
const char* outputColor,
|
||||||
@ -523,7 +523,7 @@ void GLFocalOutside2PtConicalEffect::emitCode(GrGLProgramBuilder* builder,
|
|||||||
builder->getUniformVariable(fParamUni).appendArrayAccess(1, &p1);
|
builder->getUniformVariable(fParamUni).appendArrayAccess(1, &p1);
|
||||||
|
|
||||||
// if we have a vec3 from being in perspective, convert it to a vec2 first
|
// if we have a vec3 from being in perspective, convert it to a vec2 first
|
||||||
GrGLFragmentShaderBuilder* fsBuilder = builder->getFragmentShaderBuilder();
|
GrGLFPFragmentBuilder* fsBuilder = builder->getFragmentShaderBuilder();
|
||||||
SkString coords2DString = fsBuilder->ensureFSCoords2D(coords, 0);
|
SkString coords2DString = fsBuilder->ensureFSCoords2D(coords, 0);
|
||||||
const char* coords2D = coords2DString.c_str();
|
const char* coords2D = coords2DString.c_str();
|
||||||
|
|
||||||
@ -630,7 +630,7 @@ public:
|
|||||||
GLFocalInside2PtConicalEffect(const GrBackendProcessorFactory& factory, const GrProcessor&);
|
GLFocalInside2PtConicalEffect(const GrBackendProcessorFactory& factory, const GrProcessor&);
|
||||||
virtual ~GLFocalInside2PtConicalEffect() {}
|
virtual ~GLFocalInside2PtConicalEffect() {}
|
||||||
|
|
||||||
virtual void emitCode(GrGLProgramBuilder*,
|
virtual void emitCode(GrGLFPBuilder*,
|
||||||
const GrFragmentProcessor&,
|
const GrFragmentProcessor&,
|
||||||
const GrProcessorKey&,
|
const GrProcessorKey&,
|
||||||
const char* outputColor,
|
const char* outputColor,
|
||||||
@ -710,7 +710,7 @@ GLFocalInside2PtConicalEffect::GLFocalInside2PtConicalEffect(const GrBackendProc
|
|||||||
, fFSVaryingName(NULL)
|
, fFSVaryingName(NULL)
|
||||||
, fCachedFocal(SK_ScalarMax) {}
|
, fCachedFocal(SK_ScalarMax) {}
|
||||||
|
|
||||||
void GLFocalInside2PtConicalEffect::emitCode(GrGLProgramBuilder* builder,
|
void GLFocalInside2PtConicalEffect::emitCode(GrGLFPBuilder* builder,
|
||||||
const GrFragmentProcessor&,
|
const GrFragmentProcessor&,
|
||||||
const GrProcessorKey& key,
|
const GrProcessorKey& key,
|
||||||
const char* outputColor,
|
const char* outputColor,
|
||||||
@ -728,7 +728,7 @@ void GLFocalInside2PtConicalEffect::emitCode(GrGLProgramBuilder* builder,
|
|||||||
GrGLShaderVar focal = builder->getUniformVariable(fFocalUni);
|
GrGLShaderVar focal = builder->getUniformVariable(fFocalUni);
|
||||||
|
|
||||||
// if we have a vec3 from being in perspective, convert it to a vec2 first
|
// if we have a vec3 from being in perspective, convert it to a vec2 first
|
||||||
GrGLFragmentShaderBuilder* fsBuilder = builder->getFragmentShaderBuilder();
|
GrGLFPFragmentBuilder* fsBuilder = builder->getFragmentShaderBuilder();
|
||||||
SkString coords2DString = fsBuilder->ensureFSCoords2D(coords, 0);
|
SkString coords2DString = fsBuilder->ensureFSCoords2D(coords, 0);
|
||||||
const char* coords2D = coords2DString.c_str();
|
const char* coords2D = coords2DString.c_str();
|
||||||
|
|
||||||
@ -875,7 +875,7 @@ public:
|
|||||||
GLCircleInside2PtConicalEffect(const GrBackendProcessorFactory& factory, const GrProcessor&);
|
GLCircleInside2PtConicalEffect(const GrBackendProcessorFactory& factory, const GrProcessor&);
|
||||||
virtual ~GLCircleInside2PtConicalEffect() {}
|
virtual ~GLCircleInside2PtConicalEffect() {}
|
||||||
|
|
||||||
virtual void emitCode(GrGLProgramBuilder*,
|
virtual void emitCode(GrGLFPBuilder*,
|
||||||
const GrFragmentProcessor&,
|
const GrFragmentProcessor&,
|
||||||
const GrProcessorKey&,
|
const GrProcessorKey&,
|
||||||
const char* outputColor,
|
const char* outputColor,
|
||||||
@ -963,7 +963,7 @@ GLCircleInside2PtConicalEffect::GLCircleInside2PtConicalEffect(const GrBackendPr
|
|||||||
, fCachedB(SK_ScalarMax)
|
, fCachedB(SK_ScalarMax)
|
||||||
, fCachedC(SK_ScalarMax) {}
|
, fCachedC(SK_ScalarMax) {}
|
||||||
|
|
||||||
void GLCircleInside2PtConicalEffect::emitCode(GrGLProgramBuilder* builder,
|
void GLCircleInside2PtConicalEffect::emitCode(GrGLFPBuilder* builder,
|
||||||
const GrFragmentProcessor&,
|
const GrFragmentProcessor&,
|
||||||
const GrProcessorKey& key,
|
const GrProcessorKey& key,
|
||||||
const char* outputColor,
|
const char* outputColor,
|
||||||
@ -985,7 +985,7 @@ void GLCircleInside2PtConicalEffect::emitCode(GrGLProgramBuilder* builder,
|
|||||||
GrGLShaderVar params = builder->getUniformVariable(fParamUni);
|
GrGLShaderVar params = builder->getUniformVariable(fParamUni);
|
||||||
|
|
||||||
// if we have a vec3 from being in perspective, convert it to a vec2 first
|
// if we have a vec3 from being in perspective, convert it to a vec2 first
|
||||||
GrGLFragmentShaderBuilder* fsBuilder = builder->getFragmentShaderBuilder();
|
GrGLFPFragmentBuilder* fsBuilder = builder->getFragmentShaderBuilder();
|
||||||
SkString coords2DString = fsBuilder->ensureFSCoords2D(coords, 0);
|
SkString coords2DString = fsBuilder->ensureFSCoords2D(coords, 0);
|
||||||
const char* coords2D = coords2DString.c_str();
|
const char* coords2D = coords2DString.c_str();
|
||||||
|
|
||||||
@ -1107,7 +1107,7 @@ public:
|
|||||||
GLCircleOutside2PtConicalEffect(const GrBackendProcessorFactory&, const GrProcessor&);
|
GLCircleOutside2PtConicalEffect(const GrBackendProcessorFactory&, const GrProcessor&);
|
||||||
virtual ~GLCircleOutside2PtConicalEffect() {}
|
virtual ~GLCircleOutside2PtConicalEffect() {}
|
||||||
|
|
||||||
virtual void emitCode(GrGLProgramBuilder*,
|
virtual void emitCode(GrGLFPBuilder*,
|
||||||
const GrFragmentProcessor&,
|
const GrFragmentProcessor&,
|
||||||
const GrProcessorKey&,
|
const GrProcessorKey&,
|
||||||
const char* outputColor,
|
const char* outputColor,
|
||||||
@ -1203,7 +1203,7 @@ GLCircleOutside2PtConicalEffect::GLCircleOutside2PtConicalEffect(const GrBackend
|
|||||||
fIsFlipped = data.isFlipped();
|
fIsFlipped = data.isFlipped();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLCircleOutside2PtConicalEffect::emitCode(GrGLProgramBuilder* builder,
|
void GLCircleOutside2PtConicalEffect::emitCode(GrGLFPBuilder* builder,
|
||||||
const GrFragmentProcessor&,
|
const GrFragmentProcessor&,
|
||||||
const GrProcessorKey& key,
|
const GrProcessorKey& key,
|
||||||
const char* outputColor,
|
const char* outputColor,
|
||||||
@ -1225,7 +1225,7 @@ void GLCircleOutside2PtConicalEffect::emitCode(GrGLProgramBuilder* builder,
|
|||||||
GrGLShaderVar params = builder->getUniformVariable(fParamUni);
|
GrGLShaderVar params = builder->getUniformVariable(fParamUni);
|
||||||
|
|
||||||
// if we have a vec3 from being in perspective, convert it to a vec2 first
|
// if we have a vec3 from being in perspective, convert it to a vec2 first
|
||||||
GrGLFragmentShaderBuilder* fsBuilder = builder->getFragmentShaderBuilder();
|
GrGLFPFragmentBuilder* fsBuilder = builder->getFragmentShaderBuilder();
|
||||||
SkString coords2DString = fsBuilder->ensureFSCoords2D(coords, 0);
|
SkString coords2DString = fsBuilder->ensureFSCoords2D(coords, 0);
|
||||||
const char* coords2D = coords2DString.c_str();
|
const char* coords2D = coords2DString.c_str();
|
||||||
|
|
||||||
|
@ -411,7 +411,7 @@ public:
|
|||||||
GrGLRadial2Gradient(const GrBackendProcessorFactory& factory, const GrProcessor&);
|
GrGLRadial2Gradient(const GrBackendProcessorFactory& factory, const GrProcessor&);
|
||||||
virtual ~GrGLRadial2Gradient() { }
|
virtual ~GrGLRadial2Gradient() { }
|
||||||
|
|
||||||
virtual void emitCode(GrGLProgramBuilder*,
|
virtual void emitCode(GrGLFPBuilder*,
|
||||||
const GrFragmentProcessor&,
|
const GrFragmentProcessor&,
|
||||||
const GrProcessorKey&,
|
const GrProcessorKey&,
|
||||||
const char* outputColor,
|
const char* outputColor,
|
||||||
@ -567,7 +567,7 @@ GrGLRadial2Gradient::GrGLRadial2Gradient(const GrBackendProcessorFactory& factor
|
|||||||
fIsDegenerate = data.isDegenerate();
|
fIsDegenerate = data.isDegenerate();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GrGLRadial2Gradient::emitCode(GrGLProgramBuilder* builder,
|
void GrGLRadial2Gradient::emitCode(GrGLFPBuilder* builder,
|
||||||
const GrFragmentProcessor&,
|
const GrFragmentProcessor&,
|
||||||
const GrProcessorKey& key,
|
const GrProcessorKey& key,
|
||||||
const char* outputColor,
|
const char* outputColor,
|
||||||
@ -596,7 +596,7 @@ void GrGLRadial2Gradient::emitCode(GrGLProgramBuilder* builder,
|
|||||||
builder->getUniformVariable(fParamUni).appendArrayAccess(4, &p4);
|
builder->getUniformVariable(fParamUni).appendArrayAccess(4, &p4);
|
||||||
builder->getUniformVariable(fParamUni).appendArrayAccess(5, &p5);
|
builder->getUniformVariable(fParamUni).appendArrayAccess(5, &p5);
|
||||||
|
|
||||||
GrGLFragmentShaderBuilder* fsBuilder = builder->getFragmentShaderBuilder();
|
GrGLFPFragmentBuilder* fsBuilder = builder->getFragmentShaderBuilder();
|
||||||
// We interpolate the linear component in coords[1].
|
// We interpolate the linear component in coords[1].
|
||||||
SkASSERT(coords[0].getType() == coords[1].getType());
|
SkASSERT(coords[0].getType() == coords[1].getType());
|
||||||
const char* coords2D;
|
const char* coords2D;
|
||||||
|
@ -24,7 +24,7 @@ public:
|
|||||||
GrGLBicubicEffect(const GrBackendProcessorFactory& factory,
|
GrGLBicubicEffect(const GrBackendProcessorFactory& factory,
|
||||||
const GrProcessor&);
|
const GrProcessor&);
|
||||||
|
|
||||||
virtual void emitCode(GrGLProgramBuilder*,
|
virtual void emitCode(GrGLFPBuilder*,
|
||||||
const GrFragmentProcessor&,
|
const GrFragmentProcessor&,
|
||||||
const GrProcessorKey&,
|
const GrProcessorKey&,
|
||||||
const char* outputColor,
|
const char* outputColor,
|
||||||
@ -54,7 +54,7 @@ GrGLBicubicEffect::GrGLBicubicEffect(const GrBackendProcessorFactory& factory, c
|
|||||||
: INHERITED(factory) {
|
: INHERITED(factory) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void GrGLBicubicEffect::emitCode(GrGLProgramBuilder* builder,
|
void GrGLBicubicEffect::emitCode(GrGLFPBuilder* builder,
|
||||||
const GrFragmentProcessor& effect,
|
const GrFragmentProcessor& effect,
|
||||||
const GrProcessorKey& key,
|
const GrProcessorKey& key,
|
||||||
const char* outputColor,
|
const char* outputColor,
|
||||||
@ -81,7 +81,7 @@ void GrGLBicubicEffect::emitCode(GrGLProgramBuilder* builder,
|
|||||||
GrGLShaderVar("c2", kVec4f_GrSLType),
|
GrGLShaderVar("c2", kVec4f_GrSLType),
|
||||||
GrGLShaderVar("c3", kVec4f_GrSLType),
|
GrGLShaderVar("c3", kVec4f_GrSLType),
|
||||||
};
|
};
|
||||||
GrGLFragmentShaderBuilder* fsBuilder = builder->getFragmentShaderBuilder();
|
GrGLFPFragmentBuilder* fsBuilder = builder->getFragmentShaderBuilder();
|
||||||
SkString coords2D = fsBuilder->ensureFSCoords2D(coords, 0);
|
SkString coords2D = fsBuilder->ensureFSCoords2D(coords, 0);
|
||||||
fsBuilder->emitFunction(kVec4f_GrSLType,
|
fsBuilder->emitFunction(kVec4f_GrSLType,
|
||||||
"cubicBlend",
|
"cubicBlend",
|
||||||
|
@ -24,7 +24,7 @@ public:
|
|||||||
fPMConversion = configConversionEffect.pmConversion();
|
fPMConversion = configConversionEffect.pmConversion();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void emitCode(GrGLProgramBuilder* builder,
|
virtual void emitCode(GrGLFPBuilder* builder,
|
||||||
const GrFragmentProcessor&,
|
const GrFragmentProcessor&,
|
||||||
const GrProcessorKey& key,
|
const GrProcessorKey& key,
|
||||||
const char* outputColor,
|
const char* outputColor,
|
||||||
@ -36,7 +36,7 @@ public:
|
|||||||
SkString tmpDecl;
|
SkString tmpDecl;
|
||||||
tmpVar.appendDecl(builder->ctxInfo(), &tmpDecl);
|
tmpVar.appendDecl(builder->ctxInfo(), &tmpDecl);
|
||||||
|
|
||||||
GrGLFragmentShaderBuilder* fsBuilder = builder->getFragmentShaderBuilder();
|
GrGLFPFragmentBuilder* fsBuilder = builder->getFragmentShaderBuilder();
|
||||||
|
|
||||||
fsBuilder->codeAppendf("%s;", tmpDecl.c_str());
|
fsBuilder->codeAppendf("%s;", tmpDecl.c_str());
|
||||||
|
|
||||||
|
@ -89,7 +89,7 @@ class GLAARectEffect : public GrGLFragmentProcessor {
|
|||||||
public:
|
public:
|
||||||
GLAARectEffect(const GrBackendProcessorFactory&, const GrProcessor&);
|
GLAARectEffect(const GrBackendProcessorFactory&, const GrProcessor&);
|
||||||
|
|
||||||
virtual void emitCode(GrGLProgramBuilder* builder,
|
virtual void emitCode(GrGLFPBuilder* builder,
|
||||||
const GrFragmentProcessor& fp,
|
const GrFragmentProcessor& fp,
|
||||||
const GrProcessorKey& key,
|
const GrProcessorKey& key,
|
||||||
const char* outputColor,
|
const char* outputColor,
|
||||||
@ -113,7 +113,7 @@ GLAARectEffect::GLAARectEffect(const GrBackendProcessorFactory& factory,
|
|||||||
fPrevRect.fLeft = SK_ScalarNaN;
|
fPrevRect.fLeft = SK_ScalarNaN;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLAARectEffect::emitCode(GrGLProgramBuilder* builder,
|
void GLAARectEffect::emitCode(GrGLFPBuilder* builder,
|
||||||
const GrFragmentProcessor& fp,
|
const GrFragmentProcessor& fp,
|
||||||
const GrProcessorKey& key,
|
const GrProcessorKey& key,
|
||||||
const char* outputColor,
|
const char* outputColor,
|
||||||
@ -129,7 +129,7 @@ void GLAARectEffect::emitCode(GrGLProgramBuilder* builder,
|
|||||||
"rect",
|
"rect",
|
||||||
&rectName);
|
&rectName);
|
||||||
|
|
||||||
GrGLFragmentShaderBuilder* fsBuilder = builder->getFragmentShaderBuilder();
|
GrGLFPFragmentBuilder* fsBuilder = builder->getFragmentShaderBuilder();
|
||||||
const char* fragmentPos = fsBuilder->fragmentPosition();
|
const char* fragmentPos = fsBuilder->fragmentPosition();
|
||||||
if (GrProcessorEdgeTypeIsAA(aare.getEdgeType())) {
|
if (GrProcessorEdgeTypeIsAA(aare.getEdgeType())) {
|
||||||
// The amount of coverage removed in x and y by the edges is computed as a pair of negative
|
// The amount of coverage removed in x and y by the edges is computed as a pair of negative
|
||||||
@ -183,7 +183,7 @@ class GrGLConvexPolyEffect : public GrGLFragmentProcessor {
|
|||||||
public:
|
public:
|
||||||
GrGLConvexPolyEffect(const GrBackendProcessorFactory&, const GrProcessor&);
|
GrGLConvexPolyEffect(const GrBackendProcessorFactory&, const GrProcessor&);
|
||||||
|
|
||||||
virtual void emitCode(GrGLProgramBuilder* builder,
|
virtual void emitCode(GrGLFPBuilder* builder,
|
||||||
const GrFragmentProcessor& fp,
|
const GrFragmentProcessor& fp,
|
||||||
const GrProcessorKey& key,
|
const GrProcessorKey& key,
|
||||||
const char* outputColor,
|
const char* outputColor,
|
||||||
@ -207,7 +207,7 @@ GrGLConvexPolyEffect::GrGLConvexPolyEffect(const GrBackendProcessorFactory& fact
|
|||||||
fPrevEdges[0] = SK_ScalarNaN;
|
fPrevEdges[0] = SK_ScalarNaN;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GrGLConvexPolyEffect::emitCode(GrGLProgramBuilder* builder,
|
void GrGLConvexPolyEffect::emitCode(GrGLFPBuilder* builder,
|
||||||
const GrFragmentProcessor& fp,
|
const GrFragmentProcessor& fp,
|
||||||
const GrProcessorKey& key,
|
const GrProcessorKey& key,
|
||||||
const char* outputColor,
|
const char* outputColor,
|
||||||
@ -222,7 +222,7 @@ void GrGLConvexPolyEffect::emitCode(GrGLProgramBuilder* builder,
|
|||||||
"edges",
|
"edges",
|
||||||
cpe.getEdgeCount(),
|
cpe.getEdgeCount(),
|
||||||
&edgeArrayName);
|
&edgeArrayName);
|
||||||
GrGLFragmentShaderBuilder* fsBuilder = builder->getFragmentShaderBuilder();
|
GrGLFPFragmentBuilder* fsBuilder = builder->getFragmentShaderBuilder();
|
||||||
fsBuilder->codeAppend("\t\tfloat alpha = 1.0;\n");
|
fsBuilder->codeAppend("\t\tfloat alpha = 1.0;\n");
|
||||||
fsBuilder->codeAppend("\t\tfloat edge;\n");
|
fsBuilder->codeAppend("\t\tfloat edge;\n");
|
||||||
const char* fragmentPos = fsBuilder->fragmentPosition();
|
const char* fragmentPos = fsBuilder->fragmentPosition();
|
||||||
|
@ -19,7 +19,7 @@ class GrGLConvolutionEffect : public GrGLFragmentProcessor {
|
|||||||
public:
|
public:
|
||||||
GrGLConvolutionEffect(const GrBackendProcessorFactory&, const GrProcessor&);
|
GrGLConvolutionEffect(const GrBackendProcessorFactory&, const GrProcessor&);
|
||||||
|
|
||||||
virtual void emitCode(GrGLProgramBuilder*,
|
virtual void emitCode(GrGLFPBuilder*,
|
||||||
const GrFragmentProcessor&,
|
const GrFragmentProcessor&,
|
||||||
const GrProcessorKey&,
|
const GrProcessorKey&,
|
||||||
const char* outputColor,
|
const char* outputColor,
|
||||||
@ -55,7 +55,7 @@ GrGLConvolutionEffect::GrGLConvolutionEffect(const GrBackendProcessorFactory& fa
|
|||||||
fDirection = c.direction();
|
fDirection = c.direction();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GrGLConvolutionEffect::emitCode(GrGLProgramBuilder* builder,
|
void GrGLConvolutionEffect::emitCode(GrGLFPBuilder* builder,
|
||||||
const GrFragmentProcessor&,
|
const GrFragmentProcessor&,
|
||||||
const GrProcessorKey& key,
|
const GrProcessorKey& key,
|
||||||
const char* outputColor,
|
const char* outputColor,
|
||||||
@ -71,7 +71,7 @@ void GrGLConvolutionEffect::emitCode(GrGLProgramBuilder* builder,
|
|||||||
fKernelUni = builder->addUniformArray(GrGLProgramBuilder::kFragment_Visibility,
|
fKernelUni = builder->addUniformArray(GrGLProgramBuilder::kFragment_Visibility,
|
||||||
kFloat_GrSLType, "Kernel", this->width());
|
kFloat_GrSLType, "Kernel", this->width());
|
||||||
|
|
||||||
GrGLFragmentShaderBuilder* fsBuilder = builder->getFragmentShaderBuilder();
|
GrGLFPFragmentBuilder* fsBuilder = builder->getFragmentShaderBuilder();
|
||||||
SkString coords2D = fsBuilder->ensureFSCoords2D(coords, 0);
|
SkString coords2D = fsBuilder->ensureFSCoords2D(coords, 0);
|
||||||
|
|
||||||
fsBuilder->codeAppendf("\t\t%s = vec4(0, 0, 0, 0);\n", outputColor);
|
fsBuilder->codeAppendf("\t\t%s = vec4(0, 0, 0, 0);\n", outputColor);
|
||||||
|
@ -71,7 +71,7 @@ class GLDitherEffect : public GrGLFragmentProcessor {
|
|||||||
public:
|
public:
|
||||||
GLDitherEffect(const GrBackendProcessorFactory&, const GrProcessor&);
|
GLDitherEffect(const GrBackendProcessorFactory&, const GrProcessor&);
|
||||||
|
|
||||||
virtual void emitCode(GrGLProgramBuilder* builder,
|
virtual void emitCode(GrGLFPBuilder* builder,
|
||||||
const GrFragmentProcessor& fp,
|
const GrFragmentProcessor& fp,
|
||||||
const GrProcessorKey& key,
|
const GrProcessorKey& key,
|
||||||
const char* outputColor,
|
const char* outputColor,
|
||||||
@ -88,14 +88,14 @@ GLDitherEffect::GLDitherEffect(const GrBackendProcessorFactory& factory,
|
|||||||
: INHERITED (factory) {
|
: INHERITED (factory) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLDitherEffect::emitCode(GrGLProgramBuilder* builder,
|
void GLDitherEffect::emitCode(GrGLFPBuilder* builder,
|
||||||
const GrFragmentProcessor& fp,
|
const GrFragmentProcessor& fp,
|
||||||
const GrProcessorKey& key,
|
const GrProcessorKey& key,
|
||||||
const char* outputColor,
|
const char* outputColor,
|
||||||
const char* inputColor,
|
const char* inputColor,
|
||||||
const TransformedCoordsArray&,
|
const TransformedCoordsArray&,
|
||||||
const TextureSamplerArray& samplers) {
|
const TextureSamplerArray& samplers) {
|
||||||
GrGLFragmentShaderBuilder* fsBuilder = builder->getFragmentShaderBuilder();
|
GrGLFPFragmentBuilder* fsBuilder = builder->getFragmentShaderBuilder();
|
||||||
// Generate a random number based on the fragment position. For this
|
// Generate a random number based on the fragment position. For this
|
||||||
// random number generator, we use the "GLSL rand" function
|
// random number generator, we use the "GLSL rand" function
|
||||||
// that seems to be floating around on the internet. It works under
|
// that seems to be floating around on the internet. It works under
|
||||||
|
@ -15,7 +15,7 @@ class GrGLMatrixConvolutionEffect : public GrGLFragmentProcessor {
|
|||||||
public:
|
public:
|
||||||
GrGLMatrixConvolutionEffect(const GrBackendProcessorFactory& factory,
|
GrGLMatrixConvolutionEffect(const GrBackendProcessorFactory& factory,
|
||||||
const GrProcessor&);
|
const GrProcessor&);
|
||||||
virtual void emitCode(GrGLProgramBuilder*,
|
virtual void emitCode(GrGLFPBuilder*,
|
||||||
const GrFragmentProcessor&,
|
const GrFragmentProcessor&,
|
||||||
const GrProcessorKey&,
|
const GrProcessorKey&,
|
||||||
const char* outputColor,
|
const char* outputColor,
|
||||||
@ -51,7 +51,7 @@ GrGLMatrixConvolutionEffect::GrGLMatrixConvolutionEffect(const GrBackendProcesso
|
|||||||
fConvolveAlpha = m.convolveAlpha();
|
fConvolveAlpha = m.convolveAlpha();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GrGLMatrixConvolutionEffect::emitCode(GrGLProgramBuilder* builder,
|
void GrGLMatrixConvolutionEffect::emitCode(GrGLFPBuilder* builder,
|
||||||
const GrFragmentProcessor& fp,
|
const GrFragmentProcessor& fp,
|
||||||
const GrProcessorKey& key,
|
const GrProcessorKey& key,
|
||||||
const char* outputColor,
|
const char* outputColor,
|
||||||
@ -84,7 +84,7 @@ void GrGLMatrixConvolutionEffect::emitCode(GrGLProgramBuilder* builder,
|
|||||||
int kWidth = fKernelSize.width();
|
int kWidth = fKernelSize.width();
|
||||||
int kHeight = fKernelSize.height();
|
int kHeight = fKernelSize.height();
|
||||||
|
|
||||||
GrGLFragmentShaderBuilder* fsBuilder = builder->getFragmentShaderBuilder();
|
GrGLFPFragmentBuilder* fsBuilder = builder->getFragmentShaderBuilder();
|
||||||
SkString coords2D = fsBuilder->ensureFSCoords2D(coords, 0);
|
SkString coords2D = fsBuilder->ensureFSCoords2D(coords, 0);
|
||||||
fsBuilder->codeAppend("vec4 sum = vec4(0, 0, 0, 0);");
|
fsBuilder->codeAppend("vec4 sum = vec4(0, 0, 0, 0);");
|
||||||
fsBuilder->codeAppendf("vec2 coord = %s - %s * %s;", coords2D.c_str(), kernelOffset,
|
fsBuilder->codeAppendf("vec2 coord = %s - %s * %s;", coords2D.c_str(), kernelOffset,
|
||||||
|
@ -102,7 +102,7 @@ class GLCircleEffect : public GrGLFragmentProcessor {
|
|||||||
public:
|
public:
|
||||||
GLCircleEffect(const GrBackendProcessorFactory&, const GrProcessor&);
|
GLCircleEffect(const GrBackendProcessorFactory&, const GrProcessor&);
|
||||||
|
|
||||||
virtual void emitCode(GrGLProgramBuilder* builder,
|
virtual void emitCode(GrGLFPBuilder* builder,
|
||||||
const GrFragmentProcessor& fp,
|
const GrFragmentProcessor& fp,
|
||||||
const GrProcessorKey& key,
|
const GrProcessorKey& key,
|
||||||
const char* outputColor,
|
const char* outputColor,
|
||||||
@ -128,7 +128,7 @@ GLCircleEffect::GLCircleEffect(const GrBackendProcessorFactory& factory,
|
|||||||
fPrevRadius = -1.f;
|
fPrevRadius = -1.f;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLCircleEffect::emitCode(GrGLProgramBuilder* builder,
|
void GLCircleEffect::emitCode(GrGLFPBuilder* builder,
|
||||||
const GrFragmentProcessor& fp,
|
const GrFragmentProcessor& fp,
|
||||||
const GrProcessorKey& key,
|
const GrProcessorKey& key,
|
||||||
const char* outputColor,
|
const char* outputColor,
|
||||||
@ -144,7 +144,7 @@ void GLCircleEffect::emitCode(GrGLProgramBuilder* builder,
|
|||||||
"circle",
|
"circle",
|
||||||
&circleName);
|
&circleName);
|
||||||
|
|
||||||
GrGLFragmentShaderBuilder* fsBuilder = builder->getFragmentShaderBuilder();
|
GrGLFPFragmentBuilder* fsBuilder = builder->getFragmentShaderBuilder();
|
||||||
const char* fragmentPos = fsBuilder->fragmentPosition();
|
const char* fragmentPos = fsBuilder->fragmentPosition();
|
||||||
|
|
||||||
SkASSERT(kHairlineAA_GrProcessorEdgeType != ce.getEdgeType());
|
SkASSERT(kHairlineAA_GrProcessorEdgeType != ce.getEdgeType());
|
||||||
@ -278,7 +278,7 @@ class GLEllipseEffect : public GrGLFragmentProcessor {
|
|||||||
public:
|
public:
|
||||||
GLEllipseEffect(const GrBackendProcessorFactory&, const GrProcessor&);
|
GLEllipseEffect(const GrBackendProcessorFactory&, const GrProcessor&);
|
||||||
|
|
||||||
virtual void emitCode(GrGLProgramBuilder* builder,
|
virtual void emitCode(GrGLFPBuilder* builder,
|
||||||
const GrFragmentProcessor& fp,
|
const GrFragmentProcessor& fp,
|
||||||
const GrProcessorKey& key,
|
const GrProcessorKey& key,
|
||||||
const char* outputColor,
|
const char* outputColor,
|
||||||
@ -304,7 +304,7 @@ GLEllipseEffect::GLEllipseEffect(const GrBackendProcessorFactory& factory,
|
|||||||
fPrevRadii.fX = -1.f;
|
fPrevRadii.fX = -1.f;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLEllipseEffect::emitCode(GrGLProgramBuilder* builder,
|
void GLEllipseEffect::emitCode(GrGLFPBuilder* builder,
|
||||||
const GrFragmentProcessor& fp,
|
const GrFragmentProcessor& fp,
|
||||||
const GrProcessorKey& key,
|
const GrProcessorKey& key,
|
||||||
const char* outputColor,
|
const char* outputColor,
|
||||||
@ -319,7 +319,7 @@ void GLEllipseEffect::emitCode(GrGLProgramBuilder* builder,
|
|||||||
"ellipse",
|
"ellipse",
|
||||||
&ellipseName);
|
&ellipseName);
|
||||||
|
|
||||||
GrGLFragmentShaderBuilder* fsBuilder = builder->getFragmentShaderBuilder();
|
GrGLFPFragmentBuilder* fsBuilder = builder->getFragmentShaderBuilder();
|
||||||
const char* fragmentPos = fsBuilder->fragmentPosition();
|
const char* fragmentPos = fsBuilder->fragmentPosition();
|
||||||
|
|
||||||
// d is the offset to the ellipse center
|
// d is the offset to the ellipse center
|
||||||
|
@ -137,7 +137,7 @@ class GLCircularRRectEffect : public GrGLFragmentProcessor {
|
|||||||
public:
|
public:
|
||||||
GLCircularRRectEffect(const GrBackendProcessorFactory&, const GrProcessor&);
|
GLCircularRRectEffect(const GrBackendProcessorFactory&, const GrProcessor&);
|
||||||
|
|
||||||
virtual void emitCode(GrGLProgramBuilder* builder,
|
virtual void emitCode(GrGLFPBuilder* builder,
|
||||||
const GrFragmentProcessor& fp,
|
const GrFragmentProcessor& fp,
|
||||||
const GrProcessorKey& key,
|
const GrProcessorKey& key,
|
||||||
const char* outputColor,
|
const char* outputColor,
|
||||||
@ -162,7 +162,7 @@ GLCircularRRectEffect::GLCircularRRectEffect(const GrBackendProcessorFactory& fa
|
|||||||
fPrevRRect.setEmpty();
|
fPrevRRect.setEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLCircularRRectEffect::emitCode(GrGLProgramBuilder* builder,
|
void GLCircularRRectEffect::emitCode(GrGLFPBuilder* builder,
|
||||||
const GrFragmentProcessor& fp,
|
const GrFragmentProcessor& fp,
|
||||||
const GrProcessorKey& key,
|
const GrProcessorKey& key,
|
||||||
const char* outputColor,
|
const char* outputColor,
|
||||||
@ -185,7 +185,7 @@ void GLCircularRRectEffect::emitCode(GrGLProgramBuilder* builder,
|
|||||||
"radiusPlusHalf",
|
"radiusPlusHalf",
|
||||||
&radiusPlusHalfName);
|
&radiusPlusHalfName);
|
||||||
|
|
||||||
GrGLFragmentShaderBuilder* fsBuilder = builder->getFragmentShaderBuilder();
|
GrGLFPFragmentBuilder* fsBuilder = builder->getFragmentShaderBuilder();
|
||||||
const char* fragmentPos = fsBuilder->fragmentPosition();
|
const char* fragmentPos = fsBuilder->fragmentPosition();
|
||||||
// At each quarter-circle corner we compute a vector that is the offset of the fragment position
|
// At each quarter-circle corner we compute a vector that is the offset of the fragment position
|
||||||
// from the circle center. The vector is pinned in x and y to be in the quarter-plane relevant
|
// from the circle center. The vector is pinned in x and y to be in the quarter-plane relevant
|
||||||
@ -493,7 +493,7 @@ class GLEllipticalRRectEffect : public GrGLFragmentProcessor {
|
|||||||
public:
|
public:
|
||||||
GLEllipticalRRectEffect(const GrBackendProcessorFactory&, const GrProcessor&);
|
GLEllipticalRRectEffect(const GrBackendProcessorFactory&, const GrProcessor&);
|
||||||
|
|
||||||
virtual void emitCode(GrGLProgramBuilder* builder,
|
virtual void emitCode(GrGLFPBuilder* builder,
|
||||||
const GrFragmentProcessor& effect,
|
const GrFragmentProcessor& effect,
|
||||||
const GrProcessorKey& key,
|
const GrProcessorKey& key,
|
||||||
const char* outputColor,
|
const char* outputColor,
|
||||||
@ -518,7 +518,7 @@ GLEllipticalRRectEffect::GLEllipticalRRectEffect(const GrBackendProcessorFactory
|
|||||||
fPrevRRect.setEmpty();
|
fPrevRRect.setEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLEllipticalRRectEffect::emitCode(GrGLProgramBuilder* builder,
|
void GLEllipticalRRectEffect::emitCode(GrGLFPBuilder* builder,
|
||||||
const GrFragmentProcessor& effect,
|
const GrFragmentProcessor& effect,
|
||||||
const GrProcessorKey& key,
|
const GrProcessorKey& key,
|
||||||
const char* outputColor,
|
const char* outputColor,
|
||||||
@ -533,7 +533,7 @@ void GLEllipticalRRectEffect::emitCode(GrGLProgramBuilder* builder,
|
|||||||
"innerRect",
|
"innerRect",
|
||||||
&rectName);
|
&rectName);
|
||||||
|
|
||||||
GrGLFragmentShaderBuilder* fsBuilder = builder->getFragmentShaderBuilder();
|
GrGLFPFragmentBuilder* fsBuilder = builder->getFragmentShaderBuilder();
|
||||||
const char* fragmentPos = fsBuilder->fragmentPosition();
|
const char* fragmentPos = fsBuilder->fragmentPosition();
|
||||||
// At each quarter-ellipse corner we compute a vector that is the offset of the fragment pos
|
// At each quarter-ellipse corner we compute a vector that is the offset of the fragment pos
|
||||||
// to the ellipse center. The vector is pinned in x and y to be in the quarter-plane relevant
|
// to the ellipse center. The vector is pinned in x and y to be in the quarter-plane relevant
|
||||||
|
@ -19,14 +19,14 @@ public:
|
|||||||
: INHERITED (factory) {
|
: INHERITED (factory) {
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void emitCode(GrGLProgramBuilder* builder,
|
virtual void emitCode(GrGLFPBuilder* builder,
|
||||||
const GrFragmentProcessor& fp,
|
const GrFragmentProcessor& fp,
|
||||||
const GrProcessorKey& key,
|
const GrProcessorKey& key,
|
||||||
const char* outputColor,
|
const char* outputColor,
|
||||||
const char* inputColor,
|
const char* inputColor,
|
||||||
const TransformedCoordsArray& coords,
|
const TransformedCoordsArray& coords,
|
||||||
const TextureSamplerArray& samplers) SK_OVERRIDE {
|
const TextureSamplerArray& samplers) SK_OVERRIDE {
|
||||||
GrGLFragmentShaderBuilder* fsBuilder = builder->getFragmentShaderBuilder();
|
GrGLFPFragmentBuilder* fsBuilder = builder->getFragmentShaderBuilder();
|
||||||
fsBuilder->codeAppendf("\t%s = ", outputColor);
|
fsBuilder->codeAppendf("\t%s = ", outputColor);
|
||||||
fsBuilder->appendTextureLookupAndModulate(inputColor,
|
fsBuilder->appendTextureLookupAndModulate(inputColor,
|
||||||
samplers[0],
|
samplers[0],
|
||||||
|
@ -169,7 +169,7 @@ class GrGLTextureDomainEffect : public GrGLFragmentProcessor {
|
|||||||
public:
|
public:
|
||||||
GrGLTextureDomainEffect(const GrBackendProcessorFactory&, const GrProcessor&);
|
GrGLTextureDomainEffect(const GrBackendProcessorFactory&, const GrProcessor&);
|
||||||
|
|
||||||
virtual void emitCode(GrGLProgramBuilder*,
|
virtual void emitCode(GrGLFPBuilder*,
|
||||||
const GrFragmentProcessor&,
|
const GrFragmentProcessor&,
|
||||||
const GrProcessorKey&,
|
const GrProcessorKey&,
|
||||||
const char* outputColor,
|
const char* outputColor,
|
||||||
@ -191,7 +191,7 @@ GrGLTextureDomainEffect::GrGLTextureDomainEffect(const GrBackendProcessorFactory
|
|||||||
: INHERITED(factory) {
|
: INHERITED(factory) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void GrGLTextureDomainEffect::emitCode(GrGLProgramBuilder* builder,
|
void GrGLTextureDomainEffect::emitCode(GrGLFPBuilder* builder,
|
||||||
const GrFragmentProcessor& fp,
|
const GrFragmentProcessor& fp,
|
||||||
const GrProcessorKey& key,
|
const GrProcessorKey& key,
|
||||||
const char* outputColor,
|
const char* outputColor,
|
||||||
@ -201,7 +201,7 @@ void GrGLTextureDomainEffect::emitCode(GrGLProgramBuilder* builder,
|
|||||||
const GrTextureDomainEffect& textureDomainEffect = fp.cast<GrTextureDomainEffect>();
|
const GrTextureDomainEffect& textureDomainEffect = fp.cast<GrTextureDomainEffect>();
|
||||||
const GrTextureDomain& domain = textureDomainEffect.textureDomain();
|
const GrTextureDomain& domain = textureDomainEffect.textureDomain();
|
||||||
|
|
||||||
GrGLFragmentShaderBuilder* fsBuilder = builder->getFragmentShaderBuilder();
|
GrGLFPFragmentBuilder* fsBuilder = builder->getFragmentShaderBuilder();
|
||||||
SkString coords2D = fsBuilder->ensureFSCoords2D(coords, 0);
|
SkString coords2D = fsBuilder->ensureFSCoords2D(coords, 0);
|
||||||
fGLDomain.sampleTexture(fsBuilder, domain, outputColor, coords2D, samplers[0], inputColor);
|
fGLDomain.sampleTexture(fsBuilder, domain, outputColor, coords2D, samplers[0], inputColor);
|
||||||
}
|
}
|
||||||
|
@ -45,14 +45,14 @@ public:
|
|||||||
: INHERITED(factory) {
|
: INHERITED(factory) {
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void emitCode(GrGLProgramBuilder* builder,
|
virtual void emitCode(GrGLFPBuilder* builder,
|
||||||
const GrFragmentProcessor&,
|
const GrFragmentProcessor&,
|
||||||
const GrProcessorKey&,
|
const GrProcessorKey&,
|
||||||
const char* outputColor,
|
const char* outputColor,
|
||||||
const char* inputColor,
|
const char* inputColor,
|
||||||
const TransformedCoordsArray& coords,
|
const TransformedCoordsArray& coords,
|
||||||
const TextureSamplerArray& samplers) SK_OVERRIDE {
|
const TextureSamplerArray& samplers) SK_OVERRIDE {
|
||||||
GrGLFragmentShaderBuilder* fsBuilder = builder->getFragmentShaderBuilder();
|
GrGLFPFragmentBuilder* fsBuilder = builder->getFragmentShaderBuilder();
|
||||||
|
|
||||||
const char* yuvMatrix = NULL;
|
const char* yuvMatrix = NULL;
|
||||||
fMatrixUni = builder->addUniform(GrGLProgramBuilder::kFragment_Visibility,
|
fMatrixUni = builder->addUniform(GrGLProgramBuilder::kFragment_Visibility,
|
||||||
|
@ -87,6 +87,8 @@ protected:
|
|||||||
const GrBackendProcessorFactory& fFactory;
|
const GrBackendProcessorFactory& fFactory;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class GrGLFPBuilder;
|
||||||
|
|
||||||
class GrGLFragmentProcessor : public GrGLProcessor {
|
class GrGLFragmentProcessor : public GrGLProcessor {
|
||||||
public:
|
public:
|
||||||
GrGLFragmentProcessor(const GrBackendProcessorFactory& factory)
|
GrGLFragmentProcessor(const GrBackendProcessorFactory& factory)
|
||||||
@ -113,7 +115,7 @@ public:
|
|||||||
can be passed to the builder to emit texture reads in the generated
|
can be passed to the builder to emit texture reads in the generated
|
||||||
code.
|
code.
|
||||||
*/
|
*/
|
||||||
virtual void emitCode(GrGLProgramBuilder* builder,
|
virtual void emitCode(GrGLFPBuilder* builder,
|
||||||
const GrFragmentProcessor& effect,
|
const GrFragmentProcessor& effect,
|
||||||
const GrProcessorKey& key,
|
const GrProcessorKey& key,
|
||||||
const char* outputColor,
|
const char* outputColor,
|
||||||
|
@ -147,7 +147,7 @@ public:
|
|||||||
|
|
||||||
virtual GrGpuGL* gpu() const SK_OVERRIDE { return fGpu; }
|
virtual GrGpuGL* gpu() const SK_OVERRIDE { return fGpu; }
|
||||||
|
|
||||||
virtual GrGLFragmentShaderBuilder* getFragmentShaderBuilder() SK_OVERRIDE { return &fFS; }
|
virtual GrGLFPFragmentBuilder* getFragmentShaderBuilder() SK_OVERRIDE { return &fFS; }
|
||||||
virtual GrGLVertexBuilder* getVertexShaderBuilder() SK_OVERRIDE { return &fVS; }
|
virtual GrGLVertexBuilder* getVertexShaderBuilder() SK_OVERRIDE { return &fVS; }
|
||||||
|
|
||||||
virtual void addVarying(GrSLType type,
|
virtual void addVarying(GrSLType type,
|
||||||
|
@ -70,7 +70,7 @@ public:
|
|||||||
GLBigKeyProcessor(const GrBackendProcessorFactory& factory, const GrProcessor&)
|
GLBigKeyProcessor(const GrBackendProcessorFactory& factory, const GrProcessor&)
|
||||||
: INHERITED(factory) {}
|
: INHERITED(factory) {}
|
||||||
|
|
||||||
virtual void emitCode(GrGLProgramBuilder* builder,
|
virtual void emitCode(GrGLFPBuilder* builder,
|
||||||
const GrFragmentProcessor& fp,
|
const GrFragmentProcessor& fp,
|
||||||
const GrProcessorKey& key,
|
const GrProcessorKey& key,
|
||||||
const char* outputColor,
|
const char* outputColor,
|
||||||
|
Loading…
Reference in New Issue
Block a user