Remove unused varying type param from GrGLSLShaderBuilder texture methods.
Change-Id: Icbe887266d201bc6d64555f0e793765bf641e4b6 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/262230 Commit-Queue: Brian Osman <brianosman@google.com> Reviewed-by: Brian Osman <brianosman@google.com> Auto-Submit: Brian Salomon <bsalomon@google.com>
This commit is contained in:
parent
fffb993f06
commit
d19cd76e54
@ -584,8 +584,7 @@ void GrGLDisplacementMapEffect::emitCode(EmitArgs& args) {
|
||||
GrGLSLFPFragmentBuilder* fragBuilder = args.fFragBuilder;
|
||||
fragBuilder->codeAppendf("\t\thalf4 %s = ", dColor);
|
||||
fragBuilder->appendTextureLookup(args.fTexSamplers[0],
|
||||
args.fTransformedCoords[0].fVaryingPoint.c_str(),
|
||||
args.fTransformedCoords[0].fVaryingPoint.getType());
|
||||
args.fTransformedCoords[0].fVaryingPoint.c_str());
|
||||
fragBuilder->codeAppend(";\n");
|
||||
|
||||
// Unpremultiply the displacement
|
||||
|
@ -73,7 +73,7 @@ public:
|
||||
atlasTransform, atlasTransform);
|
||||
|
||||
f->codeAppend ("coverage = ");
|
||||
f->appendTextureLookup(args.fTexSamplers[0], "texcoord", kHalf2_GrSLType);
|
||||
f->appendTextureLookup(args.fTexSamplers[0], "texcoord");
|
||||
f->codeAppend (".a;");
|
||||
|
||||
if (proc.fIsCoverageCount) {
|
||||
|
@ -231,8 +231,7 @@ void GrCCPathProcessor::Impl::onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) {
|
||||
|
||||
// Look up coverage in the atlas.
|
||||
f->codeAppendf("half coverage = ");
|
||||
f->appendTextureLookup(args.fTexSamplers[0], SkStringPrintf("%s.xy", texcoord.fsIn()).c_str(),
|
||||
kFloat2_GrSLType);
|
||||
f->appendTextureLookup(args.fTexSamplers[0], SkStringPrintf("%s.xy", texcoord.fsIn()).c_str());
|
||||
f->codeAppendf(".a;");
|
||||
|
||||
if (isCoverageCount) {
|
||||
|
@ -69,13 +69,11 @@ static void append_multitexture_lookup(GrGLSLPrimitiveProcessor::EmitArgs& args,
|
||||
// conditionally load from the indexed texture sampler
|
||||
for (int i = 0; i < numTextureSamplers-1; ++i) {
|
||||
args.fFragBuilder->codeAppendf("if (%s == %d) { %s = ", texIdx.fsIn(), i, colorName);
|
||||
args.fFragBuilder->appendTextureLookup(args.fTexSamplers[i], coordName,
|
||||
kFloat2_GrSLType);
|
||||
args.fFragBuilder->appendTextureLookup(args.fTexSamplers[i], coordName);
|
||||
args.fFragBuilder->codeAppend("; } else ");
|
||||
}
|
||||
args.fFragBuilder->codeAppendf("{ %s = ", colorName);
|
||||
args.fFragBuilder->appendTextureLookup(args.fTexSamplers[numTextureSamplers-1], coordName,
|
||||
kFloat2_GrSLType);
|
||||
args.fFragBuilder->appendTextureLookup(args.fTexSamplers[numTextureSamplers - 1], coordName);
|
||||
args.fFragBuilder->codeAppend("; }");
|
||||
}
|
||||
|
||||
|
@ -46,7 +46,7 @@ public:
|
||||
fragBuilder->codeAppend("half d = length(shadowParams.xy);");
|
||||
fragBuilder->codeAppend("float2 uv = float2(shadowParams.z * (1.0 - d), 0.5);");
|
||||
fragBuilder->codeAppend("half factor = ");
|
||||
fragBuilder->appendTextureLookup(args.fTexSamplers[0], "uv", kFloat2_GrSLType);
|
||||
fragBuilder->appendTextureLookup(args.fTexSamplers[0], "uv");
|
||||
fragBuilder->codeAppend(".a;");
|
||||
fragBuilder->codeAppendf("%s = half4(factor);", args.fOutputCoverage);
|
||||
}
|
||||
|
@ -69,8 +69,7 @@ static inline void append_texture_swizzle(SkString* out, GrSwizzle swizzle) {
|
||||
|
||||
void GrGLSLShaderBuilder::appendTextureLookup(SkString* out,
|
||||
SamplerHandle samplerHandle,
|
||||
const char* coordName,
|
||||
GrSLType varyingType) const {
|
||||
const char* coordName) const {
|
||||
const char* sampler = fProgramBuilder->samplerVariable(samplerHandle);
|
||||
out->appendf("sample(%s, %s)", sampler, coordName);
|
||||
append_texture_swizzle(out, fProgramBuilder->samplerSwizzle(samplerHandle));
|
||||
@ -78,10 +77,9 @@ void GrGLSLShaderBuilder::appendTextureLookup(SkString* out,
|
||||
|
||||
void GrGLSLShaderBuilder::appendTextureLookup(SamplerHandle samplerHandle,
|
||||
const char* coordName,
|
||||
GrSLType varyingType,
|
||||
GrGLSLColorSpaceXformHelper* colorXformHelper) {
|
||||
SkString lookup;
|
||||
this->appendTextureLookup(&lookup, samplerHandle, coordName, varyingType);
|
||||
this->appendTextureLookup(&lookup, samplerHandle, coordName);
|
||||
this->appendColorGamutXform(lookup.c_str(), colorXformHelper);
|
||||
}
|
||||
|
||||
@ -90,14 +88,13 @@ void GrGLSLShaderBuilder::appendTextureLookupAndBlend(
|
||||
SkBlendMode mode,
|
||||
SamplerHandle samplerHandle,
|
||||
const char* coordName,
|
||||
GrSLType varyingType,
|
||||
GrGLSLColorSpaceXformHelper* colorXformHelper) {
|
||||
if (!dst) {
|
||||
dst = "half4(1)";
|
||||
}
|
||||
SkString lookup;
|
||||
this->codeAppendf("%s(", GrGLSLBlend::BlendFuncName(mode));
|
||||
this->appendTextureLookup(&lookup, samplerHandle, coordName, varyingType);
|
||||
this->appendTextureLookup(&lookup, samplerHandle, coordName);
|
||||
this->appendColorGamutXform(lookup.c_str(), colorXformHelper);
|
||||
this->codeAppendf(", %s)", dst);
|
||||
}
|
||||
|
@ -28,20 +28,15 @@ public:
|
||||
|
||||
using SamplerHandle = GrGLSLUniformHandler::SamplerHandle;
|
||||
|
||||
/** 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
|
||||
/** Appends a 2D texture sample with projection if necessary. The vec length and swizzle
|
||||
order of the result depends on the GrProcessor::TextureSampler associated with the
|
||||
SamplerHandle.
|
||||
*/
|
||||
void appendTextureLookup(SkString* out,
|
||||
SamplerHandle,
|
||||
const char* coordName,
|
||||
GrSLType coordType = kHalf2_GrSLType) const;
|
||||
void appendTextureLookup(SkString* out, SamplerHandle, const char* coordName) const;
|
||||
|
||||
/** Version of above that appends the result to the shader code instead.*/
|
||||
void appendTextureLookup(SamplerHandle,
|
||||
const char* coordName,
|
||||
GrSLType coordType = kHalf2_GrSLType,
|
||||
GrGLSLColorSpaceXformHelper* colorXformHelper = nullptr);
|
||||
|
||||
/** Does the work of appendTextureLookup and blends the result by dst, treating the texture
|
||||
@ -51,7 +46,6 @@ public:
|
||||
SkBlendMode,
|
||||
SamplerHandle,
|
||||
const char* coordName,
|
||||
GrSLType coordType = kHalf2_GrSLType,
|
||||
GrGLSLColorSpaceXformHelper* colorXformHelper = nullptr);
|
||||
|
||||
/** Adds a helper function to facilitate color gamut transformation, and produces code that
|
||||
|
@ -77,8 +77,7 @@ void GrGLSLXferProcessor::emitCode(const EmitArgs& args) {
|
||||
}
|
||||
|
||||
fragBuilder->codeAppendf("half4 %s = ", dstColor);
|
||||
fragBuilder->appendTextureLookup(args.fDstTextureSamplerHandle, "_dstTexCoord",
|
||||
kHalf2_GrSLType);
|
||||
fragBuilder->appendTextureLookup(args.fDstTextureSamplerHandle, "_dstTexCoord");
|
||||
fragBuilder->codeAppend(";");
|
||||
} else {
|
||||
needsLocalOutColor = args.fShaderCaps->requiresLocalOutputColorForFBFetch();
|
||||
|
@ -82,7 +82,6 @@ public:
|
||||
SkBlendMode::kModulate,
|
||||
args.fTexSamplers[0],
|
||||
"clamp(textureCoords, textureDomain.xy, textureDomain.zw)",
|
||||
kFloat2_GrSLType,
|
||||
&fColorSpaceXformHelper);
|
||||
args.fFragBuilder->codeAppend(";");
|
||||
args.fFragBuilder->codeAppendf("%s = half4(1);", args.fOutputCoverage);
|
||||
|
@ -666,7 +666,7 @@ public:
|
||||
args.fFragBuilder->codeAppendf("%s = ", args.fOutputColor);
|
||||
args.fFragBuilder->appendTextureLookupAndBlend(
|
||||
args.fOutputColor, SkBlendMode::kModulate, args.fTexSamplers[0],
|
||||
"texCoord", kFloat2_GrSLType, &fTextureColorSpaceXformHelper);
|
||||
"texCoord", &fTextureColorSpaceXformHelper);
|
||||
args.fFragBuilder->codeAppend(";");
|
||||
if (gp.fSaturate == Saturate::kYes) {
|
||||
args.fFragBuilder->codeAppendf("%s = saturate(%s);",
|
||||
|
@ -916,8 +916,7 @@ void GrGLPerlinNoise::emitCode(EmitArgs& args) {
|
||||
xCoords.appendf("half2(%s.x, 0.5)", floorVal);
|
||||
|
||||
noiseCode.appendf("\n\thalf2 %s;\n\t%s.x = ", latticeIdx, latticeIdx);
|
||||
fragBuilder->appendTextureLookup(&noiseCode, args.fTexSamplers[0], xCoords.c_str(),
|
||||
kHalf2_GrSLType);
|
||||
fragBuilder->appendTextureLookup(&noiseCode, args.fTexSamplers[0], xCoords.c_str());
|
||||
noiseCode.append(".r;");
|
||||
}
|
||||
|
||||
@ -927,8 +926,7 @@ void GrGLPerlinNoise::emitCode(EmitArgs& args) {
|
||||
xCoords.appendf("half2(%s.z, 0.5)", floorVal);
|
||||
|
||||
noiseCode.appendf("\n\t%s.y = ", latticeIdx);
|
||||
fragBuilder->appendTextureLookup(&noiseCode, args.fTexSamplers[0], xCoords.c_str(),
|
||||
kHalf2_GrSLType);
|
||||
fragBuilder->appendTextureLookup(&noiseCode, args.fTexSamplers[0], xCoords.c_str());
|
||||
noiseCode.append(".r;");
|
||||
}
|
||||
|
||||
@ -952,8 +950,7 @@ void GrGLPerlinNoise::emitCode(EmitArgs& args) {
|
||||
SkString latticeCoords("");
|
||||
latticeCoords.appendf("half2(%s.x, %s)", bcoords, chanCoord);
|
||||
noiseCode.appendf("\n\thalf4 %s = ", lattice);
|
||||
fragBuilder->appendTextureLookup(&noiseCode, args.fTexSamplers[1], latticeCoords.c_str(),
|
||||
kHalf2_GrSLType);
|
||||
fragBuilder->appendTextureLookup(&noiseCode, args.fTexSamplers[1], latticeCoords.c_str());
|
||||
noiseCode.appendf(".bgra;\n\t%s.x = ", uv);
|
||||
noiseCode.appendf(dotLattice, lattice, lattice, inc8bit, fractVal);
|
||||
}
|
||||
@ -964,8 +961,7 @@ void GrGLPerlinNoise::emitCode(EmitArgs& args) {
|
||||
SkString latticeCoords("");
|
||||
latticeCoords.appendf("half2(%s.y, %s)", bcoords, chanCoord);
|
||||
noiseCode.append("\n\tlattice = ");
|
||||
fragBuilder->appendTextureLookup(&noiseCode, args.fTexSamplers[1], latticeCoords.c_str(),
|
||||
kHalf2_GrSLType);
|
||||
fragBuilder->appendTextureLookup(&noiseCode, args.fTexSamplers[1], latticeCoords.c_str());
|
||||
noiseCode.appendf(".bgra;\n\t%s.y = ", uv);
|
||||
noiseCode.appendf(dotLattice, lattice, lattice, inc8bit, fractVal);
|
||||
}
|
||||
@ -980,8 +976,7 @@ void GrGLPerlinNoise::emitCode(EmitArgs& args) {
|
||||
SkString latticeCoords("");
|
||||
latticeCoords.appendf("half2(%s.w, %s)", bcoords, chanCoord);
|
||||
noiseCode.append("\n\tlattice = ");
|
||||
fragBuilder->appendTextureLookup(&noiseCode, args.fTexSamplers[1], latticeCoords.c_str(),
|
||||
kHalf2_GrSLType);
|
||||
fragBuilder->appendTextureLookup(&noiseCode, args.fTexSamplers[1], latticeCoords.c_str());
|
||||
noiseCode.appendf(".bgra;\n\t%s.y = ", uv);
|
||||
noiseCode.appendf(dotLattice, lattice, lattice, inc8bit, fractVal);
|
||||
}
|
||||
@ -992,8 +987,7 @@ void GrGLPerlinNoise::emitCode(EmitArgs& args) {
|
||||
SkString latticeCoords("");
|
||||
latticeCoords.appendf("half2(%s.z, %s)", bcoords, chanCoord);
|
||||
noiseCode.append("\n\tlattice = ");
|
||||
fragBuilder->appendTextureLookup(&noiseCode, args.fTexSamplers[1], latticeCoords.c_str(),
|
||||
kHalf2_GrSLType);
|
||||
fragBuilder->appendTextureLookup(&noiseCode, args.fTexSamplers[1], latticeCoords.c_str());
|
||||
noiseCode.appendf(".bgra;\n\t%s.x = ", uv);
|
||||
noiseCode.appendf(dotLattice, lattice, lattice, inc8bit, fractVal);
|
||||
}
|
||||
@ -1280,8 +1274,8 @@ 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.
|
||||
fragBuilder->appendTextureLookup(&permCode, args.fTexSamplers[0], "float2(fract(x / 256.0), 0.0)",
|
||||
kHalf2_GrSLType);
|
||||
fragBuilder->appendTextureLookup(&permCode, args.fTexSamplers[0],
|
||||
"float2(fract(x / 256.0), 0.0)");
|
||||
permCode.append(".r * 255.0;");
|
||||
fragBuilder->emitFunction(kHalf_GrSLType, "perm", SK_ARRAY_COUNT(permArgs), permArgs,
|
||||
permCode.c_str(), &permFuncName);
|
||||
@ -1293,8 +1287,8 @@ void GrGLImprovedPerlinNoise::emitCode(EmitArgs& args) {
|
||||
};
|
||||
SkString gradFuncName;
|
||||
SkString gradCode("return half(dot(");
|
||||
fragBuilder->appendTextureLookup(&gradCode, args.fTexSamplers[1], "float2(fract(x / 16.0), 0.0)",
|
||||
kHalf2_GrSLType);
|
||||
fragBuilder->appendTextureLookup(&gradCode, args.fTexSamplers[1],
|
||||
"float2(fract(x / 16.0), 0.0)");
|
||||
gradCode.append(".rgb * 255.0 - float3(1.0), p));");
|
||||
fragBuilder->emitFunction(kHalf_GrSLType, "grad", SK_ARRAY_COUNT(gradArgs), gradArgs,
|
||||
gradCode.c_str(), &gradFuncName);
|
||||
|
Loading…
Reference in New Issue
Block a user