| Index: src/effects/SkPerlinNoiseShader.cpp
|
| diff --git a/src/effects/SkPerlinNoiseShader.cpp b/src/effects/SkPerlinNoiseShader.cpp
|
| index 63916d3ca74112045529ea2f71463af46038f567..d93c95b3d0b9cbec8b9cae2d09ab12c7682a9a76 100644
|
| --- a/src/effects/SkPerlinNoiseShader.cpp
|
| +++ b/src/effects/SkPerlinNoiseShader.cpp
|
| @@ -677,14 +677,14 @@ void GrGLPerlinNoise::emitCode(EmitArgs& args) {
|
| noiseCode.appendf("\n\t%s = fract(floor(mod(%s, 256.0)) / vec4(256.0));\n",
|
| floorVal, floorVal);
|
|
|
| + const GrGLSLSampler& sampler = uniformHandler->getSampler(args.fTexSamplers[0]);
|
| // Get permutation for x
|
| {
|
| SkString xCoords("");
|
| xCoords.appendf("vec2(%s.x, 0.5)", floorVal);
|
|
|
| noiseCode.appendf("\n\tvec2 %s;\n\t%s.x = ", latticeIdx, latticeIdx);
|
| - fragBuilder->appendTextureLookup(&noiseCode, args.fTexSamplers[0], xCoords.c_str(),
|
| - kVec2f_GrSLType);
|
| + fragBuilder->appendTextureLookup(&noiseCode, sampler, xCoords.c_str(), kVec2f_GrSLType);
|
| noiseCode.append(".r;");
|
| }
|
|
|
| @@ -694,8 +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.fTexSamplers[0], xCoords.c_str(),
|
| - kVec2f_GrSLType);
|
| + fragBuilder->appendTextureLookup(&noiseCode, sampler, xCoords.c_str(), kVec2f_GrSLType);
|
| noiseCode.append(".r;");
|
| }
|
|
|
| @@ -713,13 +712,15 @@ void GrGLPerlinNoise::emitCode(EmitArgs& args) {
|
| // Get (x,y) coordinates with the permutated x
|
| noiseCode.appendf("\n\tvec4 %s = fract(%s.xyxy + %s.yyww);", bcoords, latticeIdx, floorVal);
|
|
|
| + const GrGLSLSampler& sampler1 = uniformHandler->getSampler(args.fTexSamplers[1]);
|
| +
|
| noiseCode.appendf("\n\n\tvec2 %s;", uv);
|
| // Compute u, at offset (0,0)
|
| {
|
| SkString latticeCoords("");
|
| latticeCoords.appendf("vec2(%s.x, %s)", bcoords, chanCoord);
|
| noiseCode.appendf("\n\tvec4 %s = ", lattice);
|
| - fragBuilder->appendTextureLookup(&noiseCode, args.fTexSamplers[1], latticeCoords.c_str(),
|
| + fragBuilder->appendTextureLookup(&noiseCode, sampler1, latticeCoords.c_str(),
|
| kVec2f_GrSLType);
|
| noiseCode.appendf(".bgra;\n\t%s.x = ", uv);
|
| noiseCode.appendf(dotLattice, lattice, lattice, inc8bit, fractVal);
|
| @@ -731,7 +732,7 @@ void GrGLPerlinNoise::emitCode(EmitArgs& args) {
|
| SkString latticeCoords("");
|
| latticeCoords.appendf("vec2(%s.y, %s)", bcoords, chanCoord);
|
| noiseCode.append("\n\tlattice = ");
|
| - fragBuilder->appendTextureLookup(&noiseCode, args.fTexSamplers[1], latticeCoords.c_str(),
|
| + fragBuilder->appendTextureLookup(&noiseCode, sampler1, latticeCoords.c_str(),
|
| kVec2f_GrSLType);
|
| noiseCode.appendf(".bgra;\n\t%s.y = ", uv);
|
| noiseCode.appendf(dotLattice, lattice, lattice, inc8bit, fractVal);
|
| @@ -747,7 +748,7 @@ void GrGLPerlinNoise::emitCode(EmitArgs& args) {
|
| SkString latticeCoords("");
|
| latticeCoords.appendf("vec2(%s.w, %s)", bcoords, chanCoord);
|
| noiseCode.append("\n\tlattice = ");
|
| - fragBuilder->appendTextureLookup(&noiseCode, args.fTexSamplers[1], latticeCoords.c_str(),
|
| + fragBuilder->appendTextureLookup(&noiseCode, sampler1, latticeCoords.c_str(),
|
| kVec2f_GrSLType);
|
| noiseCode.appendf(".bgra;\n\t%s.y = ", uv);
|
| noiseCode.appendf(dotLattice, lattice, lattice, inc8bit, fractVal);
|
| @@ -759,7 +760,7 @@ void GrGLPerlinNoise::emitCode(EmitArgs& args) {
|
| SkString latticeCoords("");
|
| latticeCoords.appendf("vec2(%s.z, %s)", bcoords, chanCoord);
|
| noiseCode.append("\n\tlattice = ");
|
| - fragBuilder->appendTextureLookup(&noiseCode, args.fTexSamplers[1], latticeCoords.c_str(),
|
| + fragBuilder->appendTextureLookup(&noiseCode, sampler1, latticeCoords.c_str(),
|
| kVec2f_GrSLType);
|
| noiseCode.appendf(".bgra;\n\t%s.x = ", uv);
|
| noiseCode.appendf(dotLattice, lattice, lattice, inc8bit, fractVal);
|
|
|