Rename EmitArgs::fSamplers to fTexSamplers
Renames fSamplers to fTexSamplers in GrProcessor EmitArgs, and renames GrGLSLTextureSampler to GrGLSLSampler. This will allow us to add a second array of buffer samplers. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1862373003 Review URL: https://codereview.chromium.org/1862373003
This commit is contained in:
parent
a6b92ad1f7
commit
3f6f76f98b
@ -819,7 +819,7 @@ void GrGLPerlinNoise2::emitCode(EmitArgs& args) {
|
||||
xCoords.appendf("vec2(%s.x, 0.5)", floorVal);
|
||||
|
||||
noiseCode.appendf("\n\tvec2 %s;\n\t%s.x = ", latticeIdx, latticeIdx);
|
||||
fsBuilder->appendTextureLookup(&noiseCode, args.fSamplers[0], xCoords.c_str(),
|
||||
fsBuilder->appendTextureLookup(&noiseCode, args.fTexSamplers[0], xCoords.c_str(),
|
||||
kVec2f_GrSLType);
|
||||
noiseCode.append(".r;");
|
||||
}
|
||||
@ -830,7 +830,7 @@ void GrGLPerlinNoise2::emitCode(EmitArgs& args) {
|
||||
xCoords.appendf("vec2(%s.z, 0.5)", floorVal);
|
||||
|
||||
noiseCode.appendf("\n\t%s.y = ", latticeIdx);
|
||||
fsBuilder->appendTextureLookup(&noiseCode, args.fSamplers[0], xCoords.c_str(),
|
||||
fsBuilder->appendTextureLookup(&noiseCode, args.fTexSamplers[0], xCoords.c_str(),
|
||||
kVec2f_GrSLType);
|
||||
noiseCode.append(".r;");
|
||||
}
|
||||
@ -855,7 +855,7 @@ void GrGLPerlinNoise2::emitCode(EmitArgs& args) {
|
||||
SkString latticeCoords("");
|
||||
latticeCoords.appendf("vec2(%s.x, %s)", bcoords, chanCoord);
|
||||
noiseCode.appendf("\n\tvec4 %s = ", lattice);
|
||||
fsBuilder->appendTextureLookup(&noiseCode, args.fSamplers[1], latticeCoords.c_str(),
|
||||
fsBuilder->appendTextureLookup(&noiseCode, args.fTexSamplers[1], latticeCoords.c_str(),
|
||||
kVec2f_GrSLType);
|
||||
noiseCode.appendf(".bgra;\n\t%s.x = ", uv);
|
||||
noiseCode.appendf(dotLattice, lattice, lattice, inc8bit, fractVal);
|
||||
@ -867,7 +867,7 @@ void GrGLPerlinNoise2::emitCode(EmitArgs& args) {
|
||||
SkString latticeCoords("");
|
||||
latticeCoords.appendf("vec2(%s.y, %s)", bcoords, chanCoord);
|
||||
noiseCode.append("\n\tlattice = ");
|
||||
fsBuilder->appendTextureLookup(&noiseCode, args.fSamplers[1], latticeCoords.c_str(),
|
||||
fsBuilder->appendTextureLookup(&noiseCode, args.fTexSamplers[1], latticeCoords.c_str(),
|
||||
kVec2f_GrSLType);
|
||||
noiseCode.appendf(".bgra;\n\t%s.y = ", uv);
|
||||
noiseCode.appendf(dotLattice, lattice, lattice, inc8bit, fractVal);
|
||||
@ -883,7 +883,7 @@ void GrGLPerlinNoise2::emitCode(EmitArgs& args) {
|
||||
SkString latticeCoords("");
|
||||
latticeCoords.appendf("vec2(%s.w, %s)", bcoords, chanCoord);
|
||||
noiseCode.append("\n\tlattice = ");
|
||||
fsBuilder->appendTextureLookup(&noiseCode, args.fSamplers[1], latticeCoords.c_str(),
|
||||
fsBuilder->appendTextureLookup(&noiseCode, args.fTexSamplers[1], latticeCoords.c_str(),
|
||||
kVec2f_GrSLType);
|
||||
noiseCode.appendf(".bgra;\n\t%s.y = ", uv);
|
||||
noiseCode.appendf(dotLattice, lattice, lattice, inc8bit, fractVal);
|
||||
@ -895,7 +895,7 @@ void GrGLPerlinNoise2::emitCode(EmitArgs& args) {
|
||||
SkString latticeCoords("");
|
||||
latticeCoords.appendf("vec2(%s.z, %s)", bcoords, chanCoord);
|
||||
noiseCode.append("\n\tlattice = ");
|
||||
fsBuilder->appendTextureLookup(&noiseCode, args.fSamplers[1], latticeCoords.c_str(),
|
||||
fsBuilder->appendTextureLookup(&noiseCode, args.fTexSamplers[1], latticeCoords.c_str(),
|
||||
kVec2f_GrSLType);
|
||||
noiseCode.appendf(".bgra;\n\t%s.x = ", uv);
|
||||
noiseCode.appendf(dotLattice, lattice, lattice, inc8bit, fractVal);
|
||||
@ -1175,7 +1175,7 @@ void GrGLImprovedPerlinNoise::emitCode(EmitArgs& args) {
|
||||
SkString permCode("return ");
|
||||
// FIXME even though I'm creating these textures with kRepeat_TileMode, they're clamped. Not
|
||||
// sure why. Using fract() (here and the next texture lookup) as a workaround.
|
||||
fsBuilder->appendTextureLookup(&permCode, args.fSamplers[0], "vec2(fract(x / 256.0), 0.0)",
|
||||
fsBuilder->appendTextureLookup(&permCode, args.fTexSamplers[0], "vec2(fract(x / 256.0), 0.0)",
|
||||
kVec2f_GrSLType);
|
||||
permCode.append(".r * 255.0;");
|
||||
fsBuilder->emitFunction(kFloat_GrSLType, "perm", SK_ARRAY_COUNT(permArgs), permArgs,
|
||||
@ -1188,7 +1188,7 @@ void GrGLImprovedPerlinNoise::emitCode(EmitArgs& args) {
|
||||
};
|
||||
SkString gradFuncName;
|
||||
SkString gradCode("return dot(");
|
||||
fsBuilder->appendTextureLookup(&gradCode, args.fSamplers[1], "vec2(fract(x / 16.0), 0.0)",
|
||||
fsBuilder->appendTextureLookup(&gradCode, args.fTexSamplers[1], "vec2(fract(x / 16.0), 0.0)",
|
||||
kVec2f_GrSLType);
|
||||
gradCode.append(".rgb * 255.0 - vec3(1.0), p);");
|
||||
fsBuilder->emitFunction(kFloat_GrSLType, "grad", SK_ARRAY_COUNT(gradArgs), gradArgs,
|
||||
|
@ -390,10 +390,10 @@
|
||||
'<(skia_src_path)/gpu/glsl/GrGLSLProgramBuilder.h',
|
||||
'<(skia_src_path)/gpu/glsl/GrGLSLProgramDataManager.cpp',
|
||||
'<(skia_src_path)/gpu/glsl/GrGLSLProgramDataManager.h',
|
||||
'<(skia_src_path)/gpu/glsl/GrGLSLSampler.h',
|
||||
'<(skia_src_path)/gpu/glsl/GrGLSLShaderBuilder.cpp',
|
||||
'<(skia_src_path)/gpu/glsl/GrGLSLShaderBuilder.h',
|
||||
'<(skia_src_path)/gpu/glsl/GrGLSLShaderVar.h',
|
||||
'<(skia_src_path)/gpu/glsl/GrGLSLTextureSampler.h',
|
||||
'<(skia_src_path)/gpu/glsl/GrGLSLUniformHandler.h',
|
||||
'<(skia_src_path)/gpu/glsl/GrGLSLUtil.cpp',
|
||||
'<(skia_src_path)/gpu/glsl/GrGLSLUtil.h',
|
||||
|
@ -203,13 +203,13 @@ public:
|
||||
"Xform", &xformUniName);
|
||||
|
||||
fragBuilder->codeAppend("vec4 diffuseColor = ");
|
||||
fragBuilder->appendTextureLookupAndModulate(args.fInputColor, args.fSamplers[0],
|
||||
fragBuilder->appendTextureLookupAndModulate(args.fInputColor, args.fTexSamplers[0],
|
||||
args.fCoords[0].c_str(),
|
||||
args.fCoords[0].getType());
|
||||
fragBuilder->codeAppend(";");
|
||||
|
||||
fragBuilder->codeAppend("vec4 normalColor = ");
|
||||
fragBuilder->appendTextureLookup(args.fSamplers[1],
|
||||
fragBuilder->appendTextureLookup(args.fTexSamplers[1],
|
||||
args.fCoords[1].c_str(),
|
||||
args.fCoords[1].getType());
|
||||
fragBuilder->codeAppend(";");
|
||||
|
@ -65,7 +65,7 @@ void GrGLCircleBlurFragmentProcessor::emitCode(EmitArgs& args) {
|
||||
dataName, dataName);
|
||||
|
||||
fragBuilder->codeAppendf("float intensity = ");
|
||||
fragBuilder->appendTextureLookup(args.fSamplers[0], "vec2(dist, 0.5)");
|
||||
fragBuilder->appendTextureLookup(args.fTexSamplers[0], "vec2(dist, 0.5)");
|
||||
fragBuilder->codeAppend(".a;");
|
||||
|
||||
fragBuilder->codeAppendf("%s = src * intensity;\n", args.fOutputColor );
|
||||
|
@ -181,10 +181,10 @@ void GrGLAlphaThresholdEffect::emitCode(EmitArgs& args) {
|
||||
fragBuilder->codeAppendf("\t\tvec2 coord = %s;\n", coords2D.c_str());
|
||||
fragBuilder->codeAppendf("\t\tvec2 mask_coord = %s;\n", maskCoords2D.c_str());
|
||||
fragBuilder->codeAppend("\t\tvec4 input_color = ");
|
||||
fragBuilder->appendTextureLookup(args.fSamplers[0], "coord");
|
||||
fragBuilder->appendTextureLookup(args.fTexSamplers[0], "coord");
|
||||
fragBuilder->codeAppend(";\n");
|
||||
fragBuilder->codeAppend("\t\tvec4 mask_color = ");
|
||||
fragBuilder->appendTextureLookup(args.fSamplers[1], "mask_coord");
|
||||
fragBuilder->appendTextureLookup(args.fTexSamplers[1], "mask_coord");
|
||||
fragBuilder->codeAppend(";\n");
|
||||
|
||||
fragBuilder->codeAppendf("\t\tfloat inner_thresh = %s;\n",
|
||||
|
@ -28,7 +28,7 @@
|
||||
#include "glsl/GrGLSLFragmentProcessor.h"
|
||||
#include "glsl/GrGLSLFragmentShaderBuilder.h"
|
||||
#include "glsl/GrGLSLProgramDataManager.h"
|
||||
#include "glsl/GrGLSLTextureSampler.h"
|
||||
#include "glsl/GrGLSLSampler.h"
|
||||
#include "glsl/GrGLSLUniformHandler.h"
|
||||
#endif
|
||||
|
||||
@ -691,7 +691,7 @@ private:
|
||||
};
|
||||
|
||||
void OutputRectBlurProfileLookup(GrGLSLFPFragmentBuilder* fragBuilder,
|
||||
const GrGLSLTextureSampler& sampler,
|
||||
const GrGLSLSampler& sampler,
|
||||
const char *output,
|
||||
const char *profileSize, const char *loc,
|
||||
const char *blurred_width,
|
||||
@ -761,9 +761,9 @@ void GrGLRectBlurEffect::emitCode(EmitArgs& args) {
|
||||
fragBuilder->codeAppendf("%s vec2 wh = smallDims - vec2(center,center);",
|
||||
precisionString.c_str());
|
||||
|
||||
OutputRectBlurProfileLookup(fragBuilder, args.fSamplers[0], "horiz_lookup", profileSizeName,
|
||||
OutputRectBlurProfileLookup(fragBuilder, args.fTexSamplers[0], "horiz_lookup", profileSizeName,
|
||||
"translatedPos.x", "width", "wh.x");
|
||||
OutputRectBlurProfileLookup(fragBuilder, args.fSamplers[0], "vert_lookup", profileSizeName,
|
||||
OutputRectBlurProfileLookup(fragBuilder, args.fTexSamplers[0], "vert_lookup", profileSizeName,
|
||||
"translatedPos.y", "height", "wh.y");
|
||||
|
||||
fragBuilder->codeAppendf("float final = horiz_lookup * vert_lookup;");
|
||||
@ -1120,7 +1120,7 @@ void GrGLRRectBlurEffect::emitCode(EmitArgs& args) {
|
||||
fragBuilder->codeAppendf("vec2 texCoord = translatedFragPos / proxyDims;");
|
||||
|
||||
fragBuilder->codeAppendf("%s = ", args.fOutputColor);
|
||||
fragBuilder->appendTextureLookupAndModulate(args.fInputColor, args.fSamplers[0], "texCoord");
|
||||
fragBuilder->appendTextureLookupAndModulate(args.fInputColor, args.fTexSamplers[0], "texCoord");
|
||||
fragBuilder->codeAppend(";");
|
||||
}
|
||||
|
||||
|
@ -277,9 +277,9 @@ void GrColorCubeEffect::GLSLProcessor::emitCode(EmitArgs& args) {
|
||||
|
||||
// Apply the cube.
|
||||
fragBuilder->codeAppendf("%s = vec4(mix(", args.fOutputColor);
|
||||
fragBuilder->appendTextureLookup(args.fSamplers[0], cCoords1);
|
||||
fragBuilder->appendTextureLookup(args.fTexSamplers[0], cCoords1);
|
||||
fragBuilder->codeAppend(".bgr, ");
|
||||
fragBuilder->appendTextureLookup(args.fSamplers[0], cCoords2);
|
||||
fragBuilder->appendTextureLookup(args.fTexSamplers[0], cCoords2);
|
||||
|
||||
// Premultiply color by alpha. Note that the input alpha is not modified by this shader.
|
||||
fragBuilder->codeAppendf(".bgr, fract(%s.b)) * vec3(%s), %s.a);\n",
|
||||
|
@ -551,7 +551,7 @@ void GrGLDisplacementMapEffect::emitCode(EmitArgs& args) {
|
||||
|
||||
GrGLSLFPFragmentBuilder* fragBuilder = args.fFragBuilder;
|
||||
fragBuilder->codeAppendf("\t\tvec4 %s = ", dColor);
|
||||
fragBuilder->appendTextureLookup(args.fSamplers[0], args.fCoords[0].c_str(),
|
||||
fragBuilder->appendTextureLookup(args.fTexSamplers[0], args.fCoords[0].c_str(),
|
||||
args.fCoords[0].getType());
|
||||
fragBuilder->codeAppend(";\n");
|
||||
|
||||
@ -606,7 +606,7 @@ void GrGLDisplacementMapEffect::emitCode(EmitArgs& args) {
|
||||
domain,
|
||||
args.fOutputColor,
|
||||
SkString(cCoords),
|
||||
args.fSamplers[1]);
|
||||
args.fTexSamplers[1]);
|
||||
fragBuilder->codeAppend(";\n");
|
||||
}
|
||||
|
||||
|
@ -1824,7 +1824,7 @@ void GrGLLightingEffect::emitCode(EmitArgs& args) {
|
||||
le.domain(),
|
||||
temp.c_str(),
|
||||
texCoords,
|
||||
args.fSamplers[0]);
|
||||
args.fTexSamplers[0]);
|
||||
fragBuilder->codeAppendf("m[%d] = %s.a;", index, temp.c_str());
|
||||
index++;
|
||||
}
|
||||
|
@ -155,7 +155,7 @@ void GrGLMagnifierEffect::emitCode(EmitArgs& args) {
|
||||
|
||||
fragBuilder->codeAppend("\t\tvec2 mix_coord = mix(coord, zoom_coord, weight);\n");
|
||||
fragBuilder->codeAppend("\t\tvec4 output_color = ");
|
||||
fragBuilder->appendTextureLookup(args.fSamplers[0], "mix_coord");
|
||||
fragBuilder->appendTextureLookup(args.fTexSamplers[0], "mix_coord");
|
||||
fragBuilder->codeAppend(";\n");
|
||||
|
||||
fragBuilder->codeAppendf("\t\t%s = output_color;", args.fOutputColor);
|
||||
|
@ -239,7 +239,7 @@ void GrGLMorphologyEffect::emitCode(EmitArgs& args) {
|
||||
}
|
||||
fragBuilder->codeAppendf("\t\tfor (int i = 0; i < %d; i++) {\n", width);
|
||||
fragBuilder->codeAppendf("\t\t\t%s = %s(%s, ", args.fOutputColor, func, args.fOutputColor);
|
||||
fragBuilder->appendTextureLookup(args.fSamplers[0], "coord");
|
||||
fragBuilder->appendTextureLookup(args.fTexSamplers[0], "coord");
|
||||
fragBuilder->codeAppend(");\n");
|
||||
// coord.x += pixelSize;
|
||||
fragBuilder->codeAppendf("\t\t\tcoord.%s += %s;\n", dir, pixelSizeInc);
|
||||
|
@ -683,7 +683,7 @@ void GrGLPerlinNoise::emitCode(EmitArgs& args) {
|
||||
xCoords.appendf("vec2(%s.x, 0.5)", floorVal);
|
||||
|
||||
noiseCode.appendf("\n\tvec2 %s;\n\t%s.x = ", latticeIdx, latticeIdx);
|
||||
fragBuilder->appendTextureLookup(&noiseCode, args.fSamplers[0], xCoords.c_str(),
|
||||
fragBuilder->appendTextureLookup(&noiseCode, args.fTexSamplers[0], xCoords.c_str(),
|
||||
kVec2f_GrSLType);
|
||||
noiseCode.append(".r;");
|
||||
}
|
||||
@ -694,7 +694,7 @@ void GrGLPerlinNoise::emitCode(EmitArgs& args) {
|
||||
xCoords.appendf("vec2(%s.z, 0.5)", floorVal);
|
||||
|
||||
noiseCode.appendf("\n\t%s.y = ", latticeIdx);
|
||||
fragBuilder->appendTextureLookup(&noiseCode, args.fSamplers[0], xCoords.c_str(),
|
||||
fragBuilder->appendTextureLookup(&noiseCode, args.fTexSamplers[0], xCoords.c_str(),
|
||||
kVec2f_GrSLType);
|
||||
noiseCode.append(".r;");
|
||||
}
|
||||
@ -719,7 +719,7 @@ void GrGLPerlinNoise::emitCode(EmitArgs& args) {
|
||||
SkString latticeCoords("");
|
||||
latticeCoords.appendf("vec2(%s.x, %s)", bcoords, chanCoord);
|
||||
noiseCode.appendf("\n\tvec4 %s = ", lattice);
|
||||
fragBuilder->appendTextureLookup(&noiseCode, args.fSamplers[1], latticeCoords.c_str(),
|
||||
fragBuilder->appendTextureLookup(&noiseCode, args.fTexSamplers[1], latticeCoords.c_str(),
|
||||
kVec2f_GrSLType);
|
||||
noiseCode.appendf(".bgra;\n\t%s.x = ", uv);
|
||||
noiseCode.appendf(dotLattice, lattice, lattice, inc8bit, fractVal);
|
||||
@ -731,7 +731,7 @@ void GrGLPerlinNoise::emitCode(EmitArgs& args) {
|
||||
SkString latticeCoords("");
|
||||
latticeCoords.appendf("vec2(%s.y, %s)", bcoords, chanCoord);
|
||||
noiseCode.append("\n\tlattice = ");
|
||||
fragBuilder->appendTextureLookup(&noiseCode, args.fSamplers[1], latticeCoords.c_str(),
|
||||
fragBuilder->appendTextureLookup(&noiseCode, args.fTexSamplers[1], latticeCoords.c_str(),
|
||||
kVec2f_GrSLType);
|
||||
noiseCode.appendf(".bgra;\n\t%s.y = ", uv);
|
||||
noiseCode.appendf(dotLattice, lattice, lattice, inc8bit, fractVal);
|
||||
@ -747,7 +747,7 @@ void GrGLPerlinNoise::emitCode(EmitArgs& args) {
|
||||
SkString latticeCoords("");
|
||||
latticeCoords.appendf("vec2(%s.w, %s)", bcoords, chanCoord);
|
||||
noiseCode.append("\n\tlattice = ");
|
||||
fragBuilder->appendTextureLookup(&noiseCode, args.fSamplers[1], latticeCoords.c_str(),
|
||||
fragBuilder->appendTextureLookup(&noiseCode, args.fTexSamplers[1], latticeCoords.c_str(),
|
||||
kVec2f_GrSLType);
|
||||
noiseCode.appendf(".bgra;\n\t%s.y = ", uv);
|
||||
noiseCode.appendf(dotLattice, lattice, lattice, inc8bit, fractVal);
|
||||
@ -759,7 +759,7 @@ void GrGLPerlinNoise::emitCode(EmitArgs& args) {
|
||||
SkString latticeCoords("");
|
||||
latticeCoords.appendf("vec2(%s.z, %s)", bcoords, chanCoord);
|
||||
noiseCode.append("\n\tlattice = ");
|
||||
fragBuilder->appendTextureLookup(&noiseCode, args.fSamplers[1], latticeCoords.c_str(),
|
||||
fragBuilder->appendTextureLookup(&noiseCode, args.fTexSamplers[1], latticeCoords.c_str(),
|
||||
kVec2f_GrSLType);
|
||||
noiseCode.appendf(".bgra;\n\t%s.x = ", uv);
|
||||
noiseCode.appendf(dotLattice, lattice, lattice, inc8bit, fractVal);
|
||||
|
@ -437,22 +437,22 @@ void GLColorTableEffect::emitCode(EmitArgs& args) {
|
||||
|
||||
fragBuilder->codeAppendf("\t\t%s.a = ", args.fOutputColor);
|
||||
coord.printf("vec2(coord.a, %s.a)", yoffsets);
|
||||
fragBuilder->appendTextureLookup(args.fSamplers[0], coord.c_str());
|
||||
fragBuilder->appendTextureLookup(args.fTexSamplers[0], coord.c_str());
|
||||
fragBuilder->codeAppend(".a;\n");
|
||||
|
||||
fragBuilder->codeAppendf("\t\t%s.r = ", args.fOutputColor);
|
||||
coord.printf("vec2(coord.r, %s.r)", yoffsets);
|
||||
fragBuilder->appendTextureLookup(args.fSamplers[0], coord.c_str());
|
||||
fragBuilder->appendTextureLookup(args.fTexSamplers[0], coord.c_str());
|
||||
fragBuilder->codeAppend(".a;\n");
|
||||
|
||||
fragBuilder->codeAppendf("\t\t%s.g = ", args.fOutputColor);
|
||||
coord.printf("vec2(coord.g, %s.g)", yoffsets);
|
||||
fragBuilder->appendTextureLookup(args.fSamplers[0], coord.c_str());
|
||||
fragBuilder->appendTextureLookup(args.fTexSamplers[0], coord.c_str());
|
||||
fragBuilder->codeAppend(".a;\n");
|
||||
|
||||
fragBuilder->codeAppendf("\t\t%s.b = ", args.fOutputColor);
|
||||
coord.printf("vec2(coord.b, %s.b)", yoffsets);
|
||||
fragBuilder->appendTextureLookup(args.fSamplers[0], coord.c_str());
|
||||
fragBuilder->appendTextureLookup(args.fTexSamplers[0], coord.c_str());
|
||||
fragBuilder->codeAppend(".a;\n");
|
||||
|
||||
fragBuilder->codeAppendf("\t\t%s.rgb *= %s.a;\n", args.fOutputColor, args.fOutputColor);
|
||||
|
@ -1031,7 +1031,7 @@ void GrGLGradientEffect::emitColor(GrGLSLFPFragmentBuilder* fragBuilder,
|
||||
const char* gradientTValue,
|
||||
const char* outputColor,
|
||||
const char* inputColor,
|
||||
const TextureSamplerArray& samplers) {
|
||||
const SamplerArray& texSamplers) {
|
||||
if (SkGradientShaderBase::kTwo_GpuColorType == ge.getColorType()){
|
||||
fragBuilder->codeAppendf("\tvec4 colorTemp = mix(%s, %s, clamp(%s, 0.0, 1.0));\n",
|
||||
uniformHandler->getUniformVariable(fColorStartUni).c_str(),
|
||||
@ -1079,7 +1079,7 @@ void GrGLGradientEffect::emitColor(GrGLSLFPFragmentBuilder* fragBuilder,
|
||||
uniformHandler->getUniformVariable(fFSYUni).c_str());
|
||||
fragBuilder->codeAppendf("\t%s = ", outputColor);
|
||||
fragBuilder->appendTextureLookupAndModulate(inputColor,
|
||||
samplers[0],
|
||||
texSamplers[0],
|
||||
"coord");
|
||||
fragBuilder->codeAppend(";\n");
|
||||
}
|
||||
|
@ -423,7 +423,7 @@ protected:
|
||||
const char* gradientTValue,
|
||||
const char* outputColor,
|
||||
const char* inputColor,
|
||||
const TextureSamplerArray& samplers);
|
||||
const SamplerArray& texSamplers);
|
||||
|
||||
private:
|
||||
enum {
|
||||
|
@ -434,7 +434,7 @@ void GrGLLinearGradient::emitCode(EmitArgs& args) {
|
||||
ge, t.c_str(),
|
||||
args.fOutputColor,
|
||||
args.fInputColor,
|
||||
args.fSamplers);
|
||||
args.fTexSamplers);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
@ -332,7 +332,7 @@ void GrGLRadialGradient::emitCode(EmitArgs& args) {
|
||||
ge, t.c_str(),
|
||||
args.fOutputColor,
|
||||
args.fInputColor,
|
||||
args.fSamplers);
|
||||
args.fTexSamplers);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
@ -221,7 +221,7 @@ void GrGLSweepGradient::emitCode(EmitArgs& args) {
|
||||
ge, t.c_str(),
|
||||
args.fOutputColor,
|
||||
args.fInputColor,
|
||||
args.fSamplers);
|
||||
args.fTexSamplers);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
@ -278,7 +278,7 @@ void GLEdge2PtConicalEffect::emitCode(EmitArgs& args) {
|
||||
tName.c_str(),
|
||||
args.fOutputColor,
|
||||
args.fInputColor,
|
||||
args.fSamplers);
|
||||
args.fTexSamplers);
|
||||
fragBuilder->codeAppend("\t}\n");
|
||||
}
|
||||
|
||||
@ -545,7 +545,7 @@ void GLFocalOutside2PtConicalEffect::emitCode(EmitArgs& args) {
|
||||
tName.c_str(),
|
||||
args.fOutputColor,
|
||||
args.fInputColor,
|
||||
args.fSamplers);
|
||||
args.fTexSamplers);
|
||||
fragBuilder->codeAppend("\t}\n");
|
||||
}
|
||||
|
||||
@ -729,7 +729,7 @@ void GLFocalInside2PtConicalEffect::emitCode(EmitArgs& args) {
|
||||
tName.c_str(),
|
||||
args.fOutputColor,
|
||||
args.fInputColor,
|
||||
args.fSamplers);
|
||||
args.fTexSamplers);
|
||||
}
|
||||
|
||||
void GLFocalInside2PtConicalEffect::onSetData(const GrGLSLProgramDataManager& pdman,
|
||||
@ -994,7 +994,7 @@ void GLCircleInside2PtConicalEffect::emitCode(EmitArgs& args) {
|
||||
tName.c_str(),
|
||||
args.fOutputColor,
|
||||
args.fInputColor,
|
||||
args.fSamplers);
|
||||
args.fTexSamplers);
|
||||
}
|
||||
|
||||
void GLCircleInside2PtConicalEffect::onSetData(const GrGLSLProgramDataManager& pdman,
|
||||
@ -1245,7 +1245,7 @@ void GLCircleOutside2PtConicalEffect::emitCode(EmitArgs& args) {
|
||||
tName.c_str(),
|
||||
args.fOutputColor,
|
||||
args.fInputColor,
|
||||
args.fSamplers);
|
||||
args.fTexSamplers);
|
||||
fragBuilder->codeAppend("\t}\n");
|
||||
}
|
||||
|
||||
|
@ -99,7 +99,7 @@ void GrGLBicubicEffect::emitCode(EmitArgs& args) {
|
||||
domain,
|
||||
sampleVar.c_str(),
|
||||
coord,
|
||||
args.fSamplers[0]);
|
||||
args.fTexSamplers[0]);
|
||||
}
|
||||
fragBuilder->codeAppendf(
|
||||
"\tvec4 s%d = %s(%s, f.x, rowColors[0], rowColors[1], rowColors[2], rowColors[3]);\n",
|
||||
|
@ -66,14 +66,14 @@ public:
|
||||
if (cte.maskFormat() == kARGB_GrMaskFormat) {
|
||||
fragBuilder->codeAppendf("%s = ", args.fOutputColor);
|
||||
fragBuilder->appendTextureLookupAndModulate(args.fOutputColor,
|
||||
args.fSamplers[0],
|
||||
args.fTexSamplers[0],
|
||||
v.fsIn(),
|
||||
kVec2f_GrSLType);
|
||||
fragBuilder->codeAppend(";");
|
||||
fragBuilder->codeAppendf("%s = vec4(1);", args.fOutputCoverage);
|
||||
} else {
|
||||
fragBuilder->codeAppendf("%s = ", args.fOutputCoverage);
|
||||
fragBuilder->appendTextureLookup(args.fSamplers[0], v.fsIn(), kVec2f_GrSLType);
|
||||
fragBuilder->appendTextureLookup(args.fTexSamplers[0], v.fsIn(), kVec2f_GrSLType);
|
||||
fragBuilder->codeAppend(";");
|
||||
if (cte.maskFormat() == kA565_GrMaskFormat) {
|
||||
// set alpha to be max of rgb coverage
|
||||
|
@ -31,7 +31,7 @@ public:
|
||||
fragBuilder->codeAppendf("%s;", tmpDecl.c_str());
|
||||
|
||||
fragBuilder->codeAppendf("%s = ", tmpVar.c_str());
|
||||
fragBuilder->appendTextureLookup(args.fSamplers[0], args.fCoords[0].c_str(),
|
||||
fragBuilder->appendTextureLookup(args.fTexSamplers[0], args.fCoords[0].c_str(),
|
||||
args.fCoords[0].getType());
|
||||
fragBuilder->codeAppend(";");
|
||||
|
||||
|
@ -82,7 +82,7 @@ void GrGLConvolutionEffect::emitCode(EmitArgs& args) {
|
||||
component, bounds, component, bounds);
|
||||
}
|
||||
fragBuilder->codeAppendf("\t\t%s += ", args.fOutputColor);
|
||||
fragBuilder->appendTextureLookup(args.fSamplers[0], "coord");
|
||||
fragBuilder->appendTextureLookup(args.fTexSamplers[0], "coord");
|
||||
fragBuilder->codeAppendf(" * %s;\n", kernelIndex.c_str());
|
||||
if (ce.useBounds()) {
|
||||
fragBuilder->codeAppend("}");
|
||||
|
@ -101,7 +101,7 @@ public:
|
||||
fragBuilder->codeAppendf("vec2 uv = %s;\n", uv.fsIn());
|
||||
|
||||
fragBuilder->codeAppend("\tfloat texColor = ");
|
||||
fragBuilder->appendTextureLookup(args.fSamplers[0],
|
||||
fragBuilder->appendTextureLookup(args.fTexSamplers[0],
|
||||
"uv",
|
||||
kVec2f_GrSLType);
|
||||
fragBuilder->codeAppend(".r;\n");
|
||||
@ -338,7 +338,7 @@ public:
|
||||
fragBuilder->codeAppendf("vec2 uv = %s;", v.fsIn());
|
||||
|
||||
fragBuilder->codeAppend("float texColor = ");
|
||||
fragBuilder->appendTextureLookup(args.fSamplers[0],
|
||||
fragBuilder->appendTextureLookup(args.fTexSamplers[0],
|
||||
"uv",
|
||||
kVec2f_GrSLType);
|
||||
fragBuilder->codeAppend(".r;");
|
||||
@ -607,20 +607,20 @@ public:
|
||||
|
||||
// green is distance to uv center
|
||||
fragBuilder->codeAppend("\tvec4 texColor = ");
|
||||
fragBuilder->appendTextureLookup(args.fSamplers[0], "uv", kVec2f_GrSLType);
|
||||
fragBuilder->appendTextureLookup(args.fTexSamplers[0], "uv", kVec2f_GrSLType);
|
||||
fragBuilder->codeAppend(";\n");
|
||||
fragBuilder->codeAppend("\tvec3 distance;\n");
|
||||
fragBuilder->codeAppend("\tdistance.y = texColor.r;\n");
|
||||
// red is distance to left offset
|
||||
fragBuilder->codeAppend("\tvec2 uv_adjusted = uv - offset;\n");
|
||||
fragBuilder->codeAppend("\ttexColor = ");
|
||||
fragBuilder->appendTextureLookup(args.fSamplers[0], "uv_adjusted", kVec2f_GrSLType);
|
||||
fragBuilder->appendTextureLookup(args.fTexSamplers[0], "uv_adjusted", kVec2f_GrSLType);
|
||||
fragBuilder->codeAppend(";\n");
|
||||
fragBuilder->codeAppend("\tdistance.x = texColor.r;\n");
|
||||
// blue is distance to right offset
|
||||
fragBuilder->codeAppend("\tuv_adjusted = uv + offset;\n");
|
||||
fragBuilder->codeAppend("\ttexColor = ");
|
||||
fragBuilder->appendTextureLookup(args.fSamplers[0], "uv_adjusted", kVec2f_GrSLType);
|
||||
fragBuilder->appendTextureLookup(args.fTexSamplers[0], "uv_adjusted", kVec2f_GrSLType);
|
||||
fragBuilder->codeAppend(";\n");
|
||||
fragBuilder->codeAppend("\tdistance.z = texColor.r;\n");
|
||||
|
||||
|
@ -86,7 +86,7 @@ void GrGLMatrixConvolutionEffect::emitCode(EmitArgs& args) {
|
||||
domain,
|
||||
"c",
|
||||
coord,
|
||||
args.fSamplers[0]);
|
||||
args.fTexSamplers[0]);
|
||||
if (!mce.convolveAlpha()) {
|
||||
fragBuilder->codeAppend("c.rgb /= c.a;");
|
||||
fragBuilder->codeAppend("c.rgb = clamp(c.rgb, 0.0, 1.0);");
|
||||
@ -105,7 +105,7 @@ void GrGLMatrixConvolutionEffect::emitCode(EmitArgs& args) {
|
||||
domain,
|
||||
"c",
|
||||
coords2D,
|
||||
args.fSamplers[0]);
|
||||
args.fTexSamplers[0]);
|
||||
fragBuilder->codeAppendf("%s.a = c.a;", args.fOutputColor);
|
||||
fragBuilder->codeAppendf("%s.rgb = sum.rgb * %s + %s;", args.fOutputColor, gain, bias);
|
||||
fragBuilder->codeAppendf("%s.rgb *= %s.a;", args.fOutputColor, args.fOutputColor);
|
||||
|
@ -17,7 +17,7 @@ public:
|
||||
GrGLSLFPFragmentBuilder* fragBuilder = args.fFragBuilder;
|
||||
fragBuilder->codeAppendf("%s = ", args.fOutputColor);
|
||||
fragBuilder->appendTextureLookupAndModulate(args.fInputColor,
|
||||
args.fSamplers[0],
|
||||
args.fTexSamplers[0],
|
||||
args.fCoords[0].c_str(),
|
||||
args.fCoords[0].getType());
|
||||
fragBuilder->codeAppend(";");
|
||||
|
@ -12,8 +12,8 @@
|
||||
#include "glsl/GrGLSLFragmentProcessor.h"
|
||||
#include "glsl/GrGLSLFragmentShaderBuilder.h"
|
||||
#include "glsl/GrGLSLProgramDataManager.h"
|
||||
#include "glsl/GrGLSLSampler.h"
|
||||
#include "glsl/GrGLSLShaderBuilder.h"
|
||||
#include "glsl/GrGLSLTextureSampler.h"
|
||||
#include "glsl/GrGLSLUniformHandler.h"
|
||||
|
||||
GrTextureDomain::GrTextureDomain(const SkRect& domain, Mode mode, int index)
|
||||
@ -49,7 +49,7 @@ void GrTextureDomain::GLDomain::sampleTexture(GrGLSLShaderBuilder* builder,
|
||||
const GrTextureDomain& textureDomain,
|
||||
const char* outColor,
|
||||
const SkString& inCoords,
|
||||
const GrGLSLTextureSampler& sampler,
|
||||
const GrGLSLSampler& sampler,
|
||||
const char* inModulateColor) {
|
||||
SkASSERT((Mode)-1 == fMode || textureDomain.mode() == fMode);
|
||||
SkDEBUGCODE(fMode = textureDomain.mode();)
|
||||
@ -198,7 +198,7 @@ void GrGLTextureDomainEffect::emitCode(EmitArgs& args) {
|
||||
domain,
|
||||
args.fOutputColor,
|
||||
coords2D,
|
||||
args.fSamplers[0],
|
||||
args.fTexSamplers[0],
|
||||
args.fInputColor);
|
||||
}
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
class GrGLProgramBuilder;
|
||||
class GrGLSLShaderBuilder;
|
||||
class GrInvariantOutput;
|
||||
class GrGLSLTextureSampler;
|
||||
class GrGLSLSampler;
|
||||
class GrGLSLUniformHandler;
|
||||
struct SkRect;
|
||||
|
||||
@ -120,7 +120,7 @@ public:
|
||||
const GrTextureDomain& textureDomain,
|
||||
const char* outColor,
|
||||
const SkString& inCoords,
|
||||
const GrGLSLTextureSampler& sampler,
|
||||
const GrGLSLSampler& sampler,
|
||||
const char* inModulateColor = nullptr);
|
||||
|
||||
/**
|
||||
|
@ -106,13 +106,13 @@ public:
|
||||
kMat44f_GrSLType, kDefault_GrSLPrecision,
|
||||
"ColorSpaceMatrix", &colorSpaceMatrix);
|
||||
fragBuilder->codeAppendf("%s = vec4(", args.fOutputColor);
|
||||
fragBuilder->appendTextureLookup(args.fSamplers[0], args.fCoords[0].c_str(),
|
||||
fragBuilder->appendTextureLookup(args.fTexSamplers[0], args.fCoords[0].c_str(),
|
||||
args.fCoords[0].getType());
|
||||
fragBuilder->codeAppend(".r,");
|
||||
fragBuilder->appendTextureLookup(args.fSamplers[1], args.fCoords[1].c_str(),
|
||||
fragBuilder->appendTextureLookup(args.fTexSamplers[1], args.fCoords[1].c_str(),
|
||||
args.fCoords[1].getType());
|
||||
fragBuilder->codeAppend(".r,");
|
||||
fragBuilder->appendTextureLookup(args.fSamplers[2], args.fCoords[2].c_str(),
|
||||
fragBuilder->appendTextureLookup(args.fTexSamplers[2], args.fCoords[2].c_str(),
|
||||
args.fCoords[2].getType());
|
||||
fragBuilder->codeAppendf(".r, 1.0) * %s;", colorSpaceMatrix);
|
||||
}
|
||||
|
@ -23,7 +23,7 @@
|
||||
#include "glsl/GrGLSLFragmentProcessor.h"
|
||||
#include "glsl/GrGLSLGeometryProcessor.h"
|
||||
#include "glsl/GrGLSLProgramDataManager.h"
|
||||
#include "glsl/GrGLSLTextureSampler.h"
|
||||
#include "glsl/GrGLSLSampler.h"
|
||||
#include "glsl/GrGLSLXferProcessor.h"
|
||||
|
||||
#define GL_CALL(X) GR_GL_CALL(this->gpu()->glInterface(), X)
|
||||
|
@ -81,12 +81,12 @@ void GrGLSLFragmentProcessor::internalEmitChild(int childIndex, const char* inpu
|
||||
firstSamplerAt += args.fFp.childProcessor(i).numTextures();
|
||||
}
|
||||
GrGLSLTransformedCoordsArray childCoords;
|
||||
TextureSamplerArray childSamplers;
|
||||
SamplerArray childTexSamplers;
|
||||
if (childProc.numTransforms() > 0) {
|
||||
childCoords.push_back_n(childProc.numTransforms(), &args.fCoords[firstCoordAt]);
|
||||
}
|
||||
if (childProc.numTextures() > 0) {
|
||||
childSamplers.push_back_n(childProc.numTextures(), &args.fSamplers[firstSamplerAt]);
|
||||
childTexSamplers.push_back_n(childProc.numTextures(), &args.fTexSamplers[firstSamplerAt]);
|
||||
}
|
||||
|
||||
// emit the code for the child in its own scope
|
||||
@ -100,7 +100,7 @@ void GrGLSLFragmentProcessor::internalEmitChild(int childIndex, const char* inpu
|
||||
outputColor,
|
||||
inputColor,
|
||||
childCoords,
|
||||
childSamplers);
|
||||
childTexSamplers);
|
||||
this->childProcessor(childIndex)->emitCode(childArgs);
|
||||
fragBuilder->codeAppend("}\n");
|
||||
|
||||
|
@ -8,9 +8,10 @@
|
||||
#ifndef GrGLSLFragmentProcessor_DEFINED
|
||||
#define GrGLSLFragmentProcessor_DEFINED
|
||||
|
||||
#include "GrFragmentProcessor.h"
|
||||
#include "glsl/GrGLSLProcessorTypes.h"
|
||||
#include "glsl/GrGLSLProgramDataManager.h"
|
||||
#include "glsl/GrGLSLTextureSampler.h"
|
||||
#include "glsl/GrGLSLSampler.h"
|
||||
|
||||
class GrProcessor;
|
||||
class GrProcessorKeyBuilder;
|
||||
@ -30,7 +31,7 @@ public:
|
||||
}
|
||||
|
||||
typedef GrGLSLProgramDataManager::UniformHandle UniformHandle;
|
||||
typedef GrGLSLTextureSampler::TextureSamplerArray TextureSamplerArray;
|
||||
typedef GrGLSLSampler::SamplerArray SamplerArray;
|
||||
|
||||
/** Called when the program stage should insert its code into the shaders. The code in each
|
||||
shader will be in its own block ({}) and so locally scoped names will not collide across
|
||||
@ -59,7 +60,7 @@ public:
|
||||
const char* outputColor,
|
||||
const char* inputColor,
|
||||
const GrGLSLTransformedCoordsArray& coords,
|
||||
const TextureSamplerArray& samplers)
|
||||
const SamplerArray& texSamplers)
|
||||
: fFragBuilder(fragBuilder)
|
||||
, fUniformHandler(uniformHandler)
|
||||
, fGLSLCaps(caps)
|
||||
@ -67,7 +68,7 @@ public:
|
||||
, fOutputColor(outputColor)
|
||||
, fInputColor(inputColor)
|
||||
, fCoords(coords)
|
||||
, fSamplers(samplers) {}
|
||||
, fTexSamplers(texSamplers) {}
|
||||
GrGLSLFPFragmentBuilder* fFragBuilder;
|
||||
GrGLSLUniformHandler* fUniformHandler;
|
||||
const GrGLSLCaps* fGLSLCaps;
|
||||
@ -75,7 +76,7 @@ public:
|
||||
const char* fOutputColor;
|
||||
const char* fInputColor;
|
||||
const GrGLSLTransformedCoordsArray& fCoords;
|
||||
const TextureSamplerArray& fSamplers;
|
||||
const SamplerArray& fTexSamplers;
|
||||
};
|
||||
|
||||
virtual void emitCode(EmitArgs&) = 0;
|
||||
|
@ -11,7 +11,7 @@
|
||||
#include "GrPrimitiveProcessor.h"
|
||||
#include "glsl/GrGLSLProcessorTypes.h"
|
||||
#include "glsl/GrGLSLProgramDataManager.h"
|
||||
#include "glsl/GrGLSLTextureSampler.h"
|
||||
#include "glsl/GrGLSLSampler.h"
|
||||
|
||||
class GrBatchTracker;
|
||||
class GrPrimitiveProcessor;
|
||||
@ -27,7 +27,7 @@ public:
|
||||
virtual ~GrGLSLPrimitiveProcessor() {}
|
||||
|
||||
typedef GrGLSLProgramDataManager::UniformHandle UniformHandle;
|
||||
typedef GrGLSLTextureSampler::TextureSamplerArray TextureSamplerArray;
|
||||
typedef GrGLSLSampler::SamplerArray SamplerArray;
|
||||
|
||||
typedef SkSTArray<2, const GrCoordTransform*, true> ProcCoords;
|
||||
typedef SkSTArray<8, ProcCoords> TransformsIn;
|
||||
@ -42,7 +42,7 @@ public:
|
||||
const GrPrimitiveProcessor& gp,
|
||||
const char* outputColor,
|
||||
const char* outputCoverage,
|
||||
const TextureSamplerArray& samplers,
|
||||
const SamplerArray& texSamplers,
|
||||
const TransformsIn& transformsIn,
|
||||
TransformsOut* transformsOut)
|
||||
: fVertBuilder(vertBuilder)
|
||||
@ -53,7 +53,7 @@ public:
|
||||
, fGP(gp)
|
||||
, fOutputColor(outputColor)
|
||||
, fOutputCoverage(outputCoverage)
|
||||
, fSamplers(samplers)
|
||||
, fTexSamplers(texSamplers)
|
||||
, fTransformsIn(transformsIn)
|
||||
, fTransformsOut(transformsOut) {}
|
||||
GrGLSLVertexBuilder* fVertBuilder;
|
||||
@ -64,7 +64,7 @@ public:
|
||||
const GrPrimitiveProcessor& fGP;
|
||||
const char* fOutputColor;
|
||||
const char* fOutputCoverage;
|
||||
const TextureSamplerArray& fSamplers;
|
||||
const SamplerArray& fTexSamplers;
|
||||
const TransformsIn& fTransformsIn;
|
||||
TransformsOut* fTransformsOut;
|
||||
};
|
||||
|
@ -97,8 +97,8 @@ void GrGLSLProgramBuilder::emitAndInstallPrimProc(const GrPrimitiveProcessor& pr
|
||||
SkASSERT(!fGeometryProcessor);
|
||||
fGeometryProcessor = proc.createGLSLInstance(*this->glslCaps());
|
||||
|
||||
SkSTArray<4, GrGLSLTextureSampler> samplers(proc.numTextures());
|
||||
this->emitSamplers(proc, &samplers);
|
||||
SkSTArray<4, GrGLSLSampler> texSamplers(proc.numTextures());
|
||||
this->emitSamplers(proc, &texSamplers);
|
||||
|
||||
GrGLSLGeometryProcessor::EmitArgs args(&fVS,
|
||||
&fFS,
|
||||
@ -108,7 +108,7 @@ void GrGLSLProgramBuilder::emitAndInstallPrimProc(const GrPrimitiveProcessor& pr
|
||||
proc,
|
||||
outputColor->c_str(),
|
||||
outputCoverage->c_str(),
|
||||
samplers,
|
||||
texSamplers,
|
||||
fCoordTransforms,
|
||||
&fOutCoords);
|
||||
fGeometryProcessor->emitCode(args);
|
||||
@ -148,8 +148,8 @@ void GrGLSLProgramBuilder::emitAndInstallFragProc(const GrFragmentProcessor& fp,
|
||||
|
||||
GrGLSLFragmentProcessor* fragProc = fp.createGLSLInstance();
|
||||
|
||||
SkSTArray<4, GrGLSLTextureSampler> samplers(fp.numTextures());
|
||||
this->emitSamplers(fp, &samplers);
|
||||
SkSTArray<4, GrGLSLSampler> texSamplers(fp.numTextures());
|
||||
this->emitSamplers(fp, &texSamplers);
|
||||
|
||||
GrGLSLFragmentProcessor::EmitArgs args(&fFS,
|
||||
this->uniformHandler(),
|
||||
@ -158,7 +158,7 @@ void GrGLSLProgramBuilder::emitAndInstallFragProc(const GrFragmentProcessor& fp,
|
||||
output->c_str(),
|
||||
input.isOnes() ? nullptr : input.c_str(),
|
||||
fOutCoords[index],
|
||||
samplers);
|
||||
texSamplers);
|
||||
fragProc->emitCode(args);
|
||||
|
||||
// We have to check that effects and the code they emit are consistent, ie if an effect
|
||||
@ -193,8 +193,8 @@ void GrGLSLProgramBuilder::emitAndInstallXferProc(const GrXferProcessor& xp,
|
||||
openBrace.printf("{ // Xfer Processor: %s\n", xp.name());
|
||||
fFS.codeAppend(openBrace.c_str());
|
||||
|
||||
SkSTArray<4, GrGLSLTextureSampler> samplers(xp.numTextures());
|
||||
this->emitSamplers(xp, &samplers);
|
||||
SkSTArray<4, GrGLSLSampler> texSamplers(xp.numTextures());
|
||||
this->emitSamplers(xp, &texSamplers);
|
||||
|
||||
bool usePLSDstRead = (plsState == GrPixelLocalStorageState::kFinish_GrPixelLocalStorageState);
|
||||
GrGLSLXferProcessor::EmitArgs args(&fFS,
|
||||
@ -204,7 +204,7 @@ void GrGLSLProgramBuilder::emitAndInstallXferProc(const GrXferProcessor& xp,
|
||||
ignoresCoverage ? nullptr : coverageIn.c_str(),
|
||||
fFS.getPrimaryColorOutputName(),
|
||||
fFS.getSecondaryColorOutputName(),
|
||||
samplers,
|
||||
texSamplers,
|
||||
usePLSDstRead);
|
||||
fXferProcessor->emitCode(args);
|
||||
|
||||
@ -215,7 +215,7 @@ void GrGLSLProgramBuilder::emitAndInstallXferProc(const GrXferProcessor& xp,
|
||||
}
|
||||
|
||||
void GrGLSLProgramBuilder::emitSamplers(const GrProcessor& processor,
|
||||
GrGLSLTextureSampler::TextureSamplerArray* outSamplers) {
|
||||
GrGLSLSampler::SamplerArray* outTexSamplers) {
|
||||
int numTextures = processor.numTextures();
|
||||
UniformHandle* localSamplerUniforms = fSamplerUniforms.push_back_n(numTextures);
|
||||
SkString name;
|
||||
@ -248,7 +248,7 @@ void GrGLSLProgramBuilder::emitSamplers(const GrProcessor& processor,
|
||||
samplerType,
|
||||
precision,
|
||||
name.c_str());
|
||||
outSamplers->emplace_back(localSamplerUniforms[t], access);
|
||||
outTexSamplers->emplace_back(localSamplerUniforms[t], access.getTexture()->config());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
#include "glsl/GrGLSLPrimitiveProcessor.h"
|
||||
#include "glsl/GrGLSLProgramDataManager.h"
|
||||
#include "glsl/GrGLSLUniformHandler.h"
|
||||
#include "glsl/GrGLSLTextureSampler.h"
|
||||
#include "glsl/GrGLSLSampler.h"
|
||||
#include "glsl/GrGLSLVertexShaderBuilder.h"
|
||||
#include "glsl/GrGLSLXferProcessor.h"
|
||||
|
||||
@ -146,8 +146,7 @@ private:
|
||||
const GrGLSLExpr4& coverageIn,
|
||||
bool ignoresCoverage,
|
||||
GrPixelLocalStorageState plsState);
|
||||
void emitSamplers(const GrProcessor& processor,
|
||||
GrGLSLTextureSampler::TextureSamplerArray* outSamplers);
|
||||
void emitSamplers(const GrProcessor& processor, GrGLSLSampler::SamplerArray* outTexSamplers);
|
||||
void emitFSOutputSwizzle(bool hasSecondaryOutput);
|
||||
bool checkSamplerCounts();
|
||||
|
||||
|
@ -1,25 +1,25 @@
|
||||
/*
|
||||
* Copyright 2015 Google Inc.
|
||||
* Copyright 2016 Google Inc.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license that can be
|
||||
* found in the LICENSE file.
|
||||
*/
|
||||
|
||||
#ifndef GrGLSLTextureSampler_DEFINED
|
||||
#define GrGLSLTextureSampler_DEFINED
|
||||
#ifndef GrGLSLSampler_DEFINED
|
||||
#define GrGLSLSampler_DEFINED
|
||||
|
||||
#include "GrShaderVar.h"
|
||||
#include "GrTextureAccess.h"
|
||||
#include "GrTypes.h"
|
||||
#include "SkTArray.h"
|
||||
#include "glsl/GrGLSLProgramDataManager.h"
|
||||
|
||||
class GrGLSLTextureSampler {
|
||||
class GrGLSLSampler {
|
||||
public:
|
||||
typedef GrGLSLProgramDataManager::UniformHandle UniformHandle;
|
||||
typedef SkTArray<GrGLSLTextureSampler> TextureSamplerArray;
|
||||
typedef SkTArray<GrGLSLSampler> SamplerArray;
|
||||
|
||||
GrGLSLTextureSampler(UniformHandle uniform, const GrTextureAccess& access)
|
||||
GrGLSLSampler(UniformHandle uniform, GrPixelConfig config)
|
||||
: fSamplerUniform(uniform)
|
||||
, fConfig(access.getTexture()->config()) {
|
||||
, fConfig(config) {
|
||||
SkASSERT(kUnknown_GrPixelConfig != fConfig);
|
||||
}
|
||||
|
@ -9,7 +9,7 @@
|
||||
#include "glsl/GrGLSLShaderBuilder.h"
|
||||
#include "glsl/GrGLSLCaps.h"
|
||||
#include "glsl/GrGLSLShaderVar.h"
|
||||
#include "glsl/GrGLSLTextureSampler.h"
|
||||
#include "glsl/GrGLSLSampler.h"
|
||||
#include "glsl/GrGLSLProgramBuilder.h"
|
||||
|
||||
GrGLSLShaderBuilder::GrGLSLShaderBuilder(GrGLSLProgramBuilder* program)
|
||||
@ -63,7 +63,7 @@ void GrGLSLShaderBuilder::emitFunction(GrSLType returnType,
|
||||
}
|
||||
|
||||
void GrGLSLShaderBuilder::appendTextureLookup(SkString* out,
|
||||
const GrGLSLTextureSampler& sampler,
|
||||
const GrGLSLSampler& sampler,
|
||||
const char* coordName,
|
||||
GrSLType varyingType) const {
|
||||
const GrGLSLCaps* glslCaps = fProgramBuilder->glslCaps();
|
||||
@ -103,14 +103,14 @@ void GrGLSLShaderBuilder::appendTextureLookup(SkString* out,
|
||||
}
|
||||
}
|
||||
|
||||
void GrGLSLShaderBuilder::appendTextureLookup(const GrGLSLTextureSampler& sampler,
|
||||
void GrGLSLShaderBuilder::appendTextureLookup(const GrGLSLSampler& sampler,
|
||||
const char* coordName,
|
||||
GrSLType varyingType) {
|
||||
this->appendTextureLookup(&this->code(), sampler, coordName, varyingType);
|
||||
}
|
||||
|
||||
void GrGLSLShaderBuilder::appendTextureLookupAndModulate(const char* modulation,
|
||||
const GrGLSLTextureSampler& sampler,
|
||||
const GrGLSLSampler& sampler,
|
||||
const char* coordName,
|
||||
GrSLType varyingType) {
|
||||
SkString lookup;
|
||||
|
@ -15,7 +15,7 @@
|
||||
#include <stdarg.h>
|
||||
|
||||
class GrGLSLProgramBuilder;
|
||||
class GrGLSLTextureSampler;
|
||||
class GrGLSLSampler;
|
||||
|
||||
/**
|
||||
base class for all shaders builders
|
||||
@ -27,25 +27,25 @@ public:
|
||||
|
||||
/** Appends a 2D texture sample with projection if necessary. coordType must either be Vec2f or
|
||||
Vec3f. The latter is interpreted as projective texture coords. The vec length and swizzle
|
||||
order of the result depends on the GrTextureAccess associated with the GrGLSLTextureSampler.
|
||||
order of the result depends on the GrTextureAccess associated with the GrGLSLSampler.
|
||||
*/
|
||||
void appendTextureLookup(SkString* out,
|
||||
const GrGLSLTextureSampler&,
|
||||
const GrGLSLSampler&,
|
||||
const char* coordName,
|
||||
GrSLType coordType = kVec2f_GrSLType) const;
|
||||
|
||||
/** Version of above that appends the result to the fragment shader code instead.*/
|
||||
void appendTextureLookup(const GrGLSLTextureSampler&,
|
||||
void appendTextureLookup(const GrGLSLSampler&,
|
||||
const char* coordName,
|
||||
GrSLType coordType = kVec2f_GrSLType);
|
||||
|
||||
|
||||
/** Does the work of appendTextureLookup and modulates the result by modulation. The result is
|
||||
always a vec4. modulation and the swizzle specified by GrGLSLTextureSampler must both be
|
||||
always a vec4. modulation and the swizzle specified by GrGLSLSampler must both be
|
||||
vec4 or float. If modulation is "" or nullptr it this function acts as though
|
||||
appendTextureLookup were called. */
|
||||
void appendTextureLookupAndModulate(const char* modulation,
|
||||
const GrGLSLTextureSampler&,
|
||||
const GrGLSLSampler&,
|
||||
const char* coordName,
|
||||
GrSLType coordType = kVec2f_GrSLType);
|
||||
|
||||
|
@ -57,7 +57,7 @@ void GrGLSLXferProcessor::emitCode(const EmitArgs& args) {
|
||||
}
|
||||
|
||||
fragBuilder->codeAppendf("vec4 %s = ", dstColor);
|
||||
fragBuilder->appendTextureLookup(args.fSamplers[0], "_dstTexCoord", kVec2f_GrSLType);
|
||||
fragBuilder->appendTextureLookup(args.fTexSamplers[0], "_dstTexCoord", kVec2f_GrSLType);
|
||||
fragBuilder->codeAppend(";");
|
||||
}
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
#define GrGLSLXferProcessor_DEFINED
|
||||
|
||||
#include "glsl/GrGLSLProgramDataManager.h"
|
||||
#include "glsl/GrGLSLTextureSampler.h"
|
||||
#include "glsl/GrGLSLSampler.h"
|
||||
|
||||
class GrXferProcessor;
|
||||
class GrGLSLCaps;
|
||||
@ -22,7 +22,7 @@ public:
|
||||
GrGLSLXferProcessor() {}
|
||||
virtual ~GrGLSLXferProcessor() {}
|
||||
|
||||
typedef GrGLSLTextureSampler::TextureSamplerArray TextureSamplerArray;
|
||||
typedef GrGLSLSampler::SamplerArray SamplerArray;
|
||||
struct EmitArgs {
|
||||
EmitArgs(GrGLSLXPFragmentBuilder* fragBuilder,
|
||||
GrGLSLUniformHandler* uniformHandler,
|
||||
@ -32,7 +32,7 @@ public:
|
||||
const char* inputCoverage,
|
||||
const char* outputPrimary,
|
||||
const char* outputSecondary,
|
||||
const TextureSamplerArray& samplers,
|
||||
const SamplerArray& texSamplers,
|
||||
const bool usePLSDstRead)
|
||||
: fXPFragBuilder(fragBuilder)
|
||||
, fUniformHandler(uniformHandler)
|
||||
@ -42,7 +42,7 @@ public:
|
||||
, fInputCoverage(inputCoverage)
|
||||
, fOutputPrimary(outputPrimary)
|
||||
, fOutputSecondary(outputSecondary)
|
||||
, fSamplers(samplers)
|
||||
, fTexSamplers(texSamplers)
|
||||
, fUsePLSDstRead(usePLSDstRead) {}
|
||||
|
||||
GrGLSLXPFragmentBuilder* fXPFragBuilder;
|
||||
@ -53,7 +53,7 @@ public:
|
||||
const char* fInputCoverage;
|
||||
const char* fOutputPrimary;
|
||||
const char* fOutputSecondary;
|
||||
const TextureSamplerArray& fSamplers;
|
||||
const SamplerArray& fTexSamplers;
|
||||
bool fUsePLSDstRead;
|
||||
};
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user