Remove unneeded GrGLSLTransformedCoordsArray type

Rename GrGLSLFragmentBuilder::ensureFSCoords2D to ensureCoords2D and make it take an arbitrary GrShaderVar.
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2324663004

Review-Url: https://codereview.chromium.org/2324663004
This commit is contained in:
bsalomon 2016-09-12 09:30:36 -07:00 committed by Commit bot
parent a316395e66
commit 1a1aa93034
28 changed files with 86 additions and 103 deletions

View File

@ -739,7 +739,7 @@ void GrGLPerlinNoise2::emitCode(EmitArgs& args) {
GrGLSLFragmentBuilder* fsBuilder = args.fFragBuilder;
GrGLSLUniformHandler* uniformHandler = args.fUniformHandler;
SkString vCoords = fsBuilder->ensureFSCoords2D(args.fCoords, 0);
SkString vCoords = fsBuilder->ensureCoords2D(args.fTransformedCoords[0]);
fBaseFrequencyUni = uniformHandler->addUniform(kFragment_GrShaderFlag,
kVec2f_GrSLType, kDefault_GrSLPrecision,
@ -1145,7 +1145,7 @@ sk_sp<GrFragmentProcessor> GrImprovedPerlinNoiseEffect::TestCreate(GrProcessorTe
void GrGLImprovedPerlinNoise::emitCode(EmitArgs& args) {
GrGLSLFragmentBuilder* fsBuilder = args.fFragBuilder;
GrGLSLUniformHandler* uniformHandler = args.fUniformHandler;
SkString vCoords = fsBuilder->ensureFSCoords2D(args.fCoords, 0);
SkString vCoords = fsBuilder->ensureCoords2D(args.fTransformedCoords[0]);
fBaseFrequencyUni = uniformHandler->addUniform(kFragment_GrShaderFlag,
kVec2f_GrSLType, kDefault_GrSLPrecision,

View File

@ -65,8 +65,8 @@ public:
class DCGLFP : public GrGLSLFragmentProcessor {
void emitCode(EmitArgs& args) override {
GrGLSLFragmentBuilder* fragBuilder = args.fFragBuilder;
fragBuilder->codeAppendf("vec2 c = %s;",
fragBuilder->ensureFSCoords2D(args.fCoords, 0).c_str());
SkString coords2d = fragBuilder->ensureCoords2D(args.fTransformedCoords[0]);
fragBuilder->codeAppendf("vec2 c = %s;", coords2d.c_str());
fragBuilder->codeAppend("vec2 r = mod(c, vec2(20.0));");
fragBuilder->codeAppend("vec4 color = vec4(0.5*sin(c.x / 15.0) + 0.5,"
"0.5*cos((c.x + c.y) / 15.0) + 0.5,"

View File

@ -417,7 +417,6 @@
'<(skia_src_path)/gpu/glsl/GrGLSLGeometryShaderBuilder.h',
'<(skia_src_path)/gpu/glsl/GrGLSLPrimitiveProcessor.cpp',
'<(skia_src_path)/gpu/glsl/GrGLSLPrimitiveProcessor.h',
'<(skia_src_path)/gpu/glsl/GrGLSLProcessorTypes.h',
'<(skia_src_path)/gpu/glsl/GrGLSLProgramBuilder.cpp',
'<(skia_src_path)/gpu/glsl/GrGLSLProgramBuilder.h',
'<(skia_src_path)/gpu/glsl/GrGLSLProgramDataManager.cpp',

View File

@ -99,8 +99,8 @@ void GrGLAlphaThresholdFragmentProcessor::emitCode(EmitArgs& args) {
"outer_threshold");
GrGLSLFPFragmentBuilder* fragBuilder = args.fFragBuilder;
SkString coords2D = fragBuilder->ensureFSCoords2D(args.fCoords, 0);
SkString maskCoords2D = fragBuilder->ensureFSCoords2D(args.fCoords, 1);
SkString coords2D = fragBuilder->ensureCoords2D(args.fTransformedCoords[0]);
SkString maskCoords2D = fragBuilder->ensureCoords2D(args.fTransformedCoords[1]);
fragBuilder->codeAppendf("vec2 coord = %s;", coords2D.c_str());
fragBuilder->codeAppendf("vec2 mask_coord = %s;", maskCoords2D.c_str());

View File

@ -544,15 +544,15 @@ void GrGLDisplacementMapEffect::emitCode(EmitArgs& args) {
GrGLSLFPFragmentBuilder* fragBuilder = args.fFragBuilder;
fragBuilder->codeAppendf("\t\tvec4 %s = ", dColor);
fragBuilder->appendTextureLookup(args.fTexSamplers[0], args.fCoords[0].c_str(),
args.fCoords[0].getType());
fragBuilder->appendTextureLookup(args.fTexSamplers[0], args.fTransformedCoords[0].c_str(),
args.fTransformedCoords[0].getType());
fragBuilder->codeAppend(";\n");
// Unpremultiply the displacement
fragBuilder->codeAppendf(
"\t\t%s.rgb = (%s.a < %s) ? vec3(0.0) : clamp(%s.rgb / %s.a, 0.0, 1.0);",
dColor, dColor, nearZero, dColor, dColor);
SkString coords2D = fragBuilder->ensureFSCoords2D(args.fCoords, 1);
SkString coords2D = fragBuilder->ensureCoords2D(args.fTransformedCoords[1]);
fragBuilder->codeAppendf("\t\tvec2 %s = %s + %s*(%s.",
cCoords, coords2D.c_str(), scaleUni, dColor);

View File

@ -1803,7 +1803,7 @@ void GrGLLightingEffect::emitCode(EmitArgs& args) {
GrGLSLShaderVar("scale", kFloat_GrSLType),
};
SkString sobelFuncName;
SkString coords2D = fragBuilder->ensureFSCoords2D(args.fCoords, 0);
SkString coords2D = fragBuilder->ensureCoords2D(args.fTransformedCoords[0]);
fragBuilder->emitFunction(kFloat_GrSLType,
"sobel",

View File

@ -135,7 +135,7 @@ void GrGLMagnifierEffect::emitCode(EmitArgs& args) {
"Bounds");
GrGLSLFPFragmentBuilder* fragBuilder = args.fFragBuilder;
SkString coords2D = fragBuilder->ensureFSCoords2D(args.fCoords, 0);
SkString coords2D = fragBuilder->ensureCoords2D(args.fTransformedCoords[0]);
fragBuilder->codeAppendf("\t\tvec2 coord = %s;\n", coords2D.c_str());
fragBuilder->codeAppendf("\t\tvec2 zoom_coord = %s + %s * %s;\n",
uniformHandler->getUniformCStr(fOffsetVar),

View File

@ -218,7 +218,7 @@ void GrGLMorphologyEffect::emitCode(EmitArgs& args) {
const char* range = uniformHandler->getUniformCStr(fRangeUni);
GrGLSLFPFragmentBuilder* fragBuilder = args.fFragBuilder;
SkString coords2D = fragBuilder->ensureFSCoords2D(args.fCoords, 0);
SkString coords2D = fragBuilder->ensureCoords2D(args.fTransformedCoords[0]);
const char* func;
switch (me.type()) {
case GrMorphologyEffect::kErode_MorphologyType:

View File

@ -603,7 +603,7 @@ void GrGLPerlinNoise::emitCode(EmitArgs& args) {
GrGLSLFPFragmentBuilder* fragBuilder = args.fFragBuilder;
GrGLSLUniformHandler* uniformHandler = args.fUniformHandler;
SkString vCoords = fragBuilder->ensureFSCoords2D(args.fCoords, 0);
SkString vCoords = fragBuilder->ensureCoords2D(args.fTransformedCoords[0]);
fBaseFrequencyUni = uniformHandler->addUniform(kFragment_GrShaderFlag,
kVec2f_GrSLType, kDefault_GrSLPrecision,

View File

@ -437,7 +437,7 @@ sk_sp<GrFragmentProcessor> GrLinearGradient::TestCreate(GrProcessorTestData* d)
void GrLinearGradient::GLSLLinearProcessor::emitCode(EmitArgs& args) {
const GrLinearGradient& ge = args.fFp.cast<GrLinearGradient>();
this->emitUniforms(args.fUniformHandler, ge);
SkString t = args.fFragBuilder->ensureFSCoords2D(args.fCoords, 0);
SkString t = args.fFragBuilder->ensureCoords2D(args.fTransformedCoords[0]);
t.append(".x");
this->emitColor(args.fFragBuilder,
args.fUniformHandler,

View File

@ -333,7 +333,7 @@ void GrRadialGradient::GLSLRadialProcessor::emitCode(EmitArgs& args) {
const GrRadialGradient& ge = args.fFp.cast<GrRadialGradient>();
this->emitUniforms(args.fUniformHandler, ge);
SkString t("length(");
t.append(args.fFragBuilder->ensureFSCoords2D(args.fCoords, 0));
t.append(args.fFragBuilder->ensureCoords2D(args.fTransformedCoords[0]));
t.append(")");
this->emitColor(args.fFragBuilder,
args.fUniformHandler,

View File

@ -212,7 +212,7 @@ sk_sp<GrFragmentProcessor> GrSweepGradient::TestCreate(GrProcessorTestData* d) {
void GrSweepGradient::GLSLSweepProcessor::emitCode(EmitArgs& args) {
const GrSweepGradient& ge = args.fFp.cast<GrSweepGradient>();
this->emitUniforms(args.fUniformHandler, ge);
SkString coords2D = args.fFragBuilder->ensureFSCoords2D(args.fCoords, 0);
SkString coords2D = args.fFragBuilder->ensureCoords2D(args.fTransformedCoords[0]);
SkString t;
// 0.1591549430918 is 1/(2*pi), used since atan returns values [-pi, pi]
// On Intel GPU there is an issue where it reads the second arguement to atan "- %s.x" as an int

View File

@ -243,19 +243,21 @@ void Edge2PtConicalEffect::GLSLEdge2PtConicalProcessor::emitCode(EmitArgs& args)
p2.appendf("%s.z", uniformHandler->getUniformVariable(fParamUni).getName().c_str());
// We interpolate the linear component in coords[1].
SkASSERT(args.fCoords[0].getType() == args.fCoords[1].getType());
SkASSERT(args.fTransformedCoords[0].getType() == args.fTransformedCoords[1].getType());
const char* coords2D;
SkString bVar;
GrGLSLFPFragmentBuilder* fragBuilder = args.fFragBuilder;
if (kVec3f_GrSLType == args.fCoords[0].getType()) {
if (kVec3f_GrSLType == args.fTransformedCoords[0].getType()) {
fragBuilder->codeAppendf("\tvec3 interpolants = vec3(%s.xy / %s.z, %s.x / %s.z);\n",
args.fCoords[0].c_str(), args.fCoords[0].c_str(),
args.fCoords[1].c_str(), args.fCoords[1].c_str());
args.fTransformedCoords[0].c_str(),
args.fTransformedCoords[0].c_str(),
args.fTransformedCoords[1].c_str(),
args.fTransformedCoords[1].c_str());
coords2D = "interpolants.xy";
bVar = "interpolants.z";
} else {
coords2D = args.fCoords[0].c_str();
bVar.printf("%s.x", args.fCoords[1].c_str());
coords2D = args.fTransformedCoords[0].c_str();
bVar.printf("%s.x", args.fTransformedCoords[1].c_str());
}
// output will default to transparent black (we simply won't write anything
@ -523,7 +525,7 @@ void FocalOutside2PtConicalEffect::GLSLFocalOutside2PtConicalProcessor::emitCode
// if we have a vec3 from being in perspective, convert it to a vec2 first
GrGLSLFPFragmentBuilder* fragBuilder = args.fFragBuilder;
SkString coords2DString = fragBuilder->ensureFSCoords2D(args.fCoords, 0);
SkString coords2DString = fragBuilder->ensureCoords2D(args.fTransformedCoords[0]);
const char* coords2D = coords2DString.c_str();
// t = p.x * focal.x +/- sqrt(p.x^2 + (1 - focal.x^2) * p.y^2)
@ -731,7 +733,7 @@ void FocalInside2PtConicalEffect::GLSLFocalInside2PtConicalProcessor::emitCode(E
// if we have a vec3 from being in perspective, convert it to a vec2 first
GrGLSLFPFragmentBuilder* fragBuilder = args.fFragBuilder;
SkString coords2DString = fragBuilder->ensureFSCoords2D(args.fCoords, 0);
SkString coords2DString = fragBuilder->ensureCoords2D(args.fTransformedCoords[0]);
const char* coords2D = coords2DString.c_str();
// t = p.x * focalX + length(p)
@ -994,7 +996,7 @@ void CircleInside2PtConicalEffect::GLSLCircleInside2PtConicalProcessor::emitCode
// if we have a vec3 from being in perspective, convert it to a vec2 first
GrGLSLFPFragmentBuilder* fragBuilder = args.fFragBuilder;
SkString coords2DString = fragBuilder->ensureFSCoords2D(args.fCoords, 0);
SkString coords2DString = fragBuilder->ensureCoords2D(args.fTransformedCoords[0]);
const char* coords2D = coords2DString.c_str();
// p = coords2D
@ -1237,7 +1239,7 @@ void CircleOutside2PtConicalEffect::GLSLCircleOutside2PtConicalProcessor::emitCo
// if we have a vec3 from being in perspective, convert it to a vec2 first
GrGLSLFPFragmentBuilder* fragBuilder = args.fFragBuilder;
SkString coords2DString = fragBuilder->ensureFSCoords2D(args.fCoords, 0);
SkString coords2DString = fragBuilder->ensureCoords2D(args.fTransformedCoords[0]);
const char* coords2D = coords2DString.c_str();
// output will default to transparent black (we simply won't write anything

View File

@ -10,7 +10,6 @@
#include "gl/GrGLGpu.h"
#include "glsl/GrGLSLCaps.h"
#include "glsl/GrGLSLFragmentShaderBuilder.h"
#include "glsl/GrGLSLProcessorTypes.h"
#include "glsl/GrGLSLUniformHandler.h"
#include "glsl/GrGLSLVarying.h"

View File

@ -75,7 +75,7 @@ void GrGLBicubicEffect::emitCode(EmitArgs& args) {
GrGLSLShaderVar("c3", kVec4f_GrSLType),
};
GrGLSLFPFragmentBuilder* fragBuilder = args.fFragBuilder;
SkString coords2D = fragBuilder->ensureFSCoords2D(args.fCoords, 0);
SkString coords2D = fragBuilder->ensureCoords2D(args.fTransformedCoords[0]);
fragBuilder->emitFunction(kVec4f_GrSLType,
"cubicBlend",
SK_ARRAY_COUNT(gCubicBlendArgs),

View File

@ -31,8 +31,8 @@ public:
fragBuilder->codeAppendf("%s;", tmpDecl.c_str());
fragBuilder->codeAppendf("%s = ", tmpVar.c_str());
fragBuilder->appendTextureLookup(args.fTexSamplers[0], args.fCoords[0].c_str(),
args.fCoords[0].getType());
fragBuilder->appendTextureLookup(args.fTexSamplers[0], args.fTransformedCoords[0].c_str(),
args.fTransformedCoords[0].getType());
fragBuilder->codeAppend(";");
if (GrConfigConversionEffect::kNone_PMConversion == pmConversion) {

View File

@ -54,7 +54,7 @@ void GrGLConvolutionEffect::emitCode(EmitArgs& args) {
"Kernel", arrayCount);
GrGLSLFPFragmentBuilder* fragBuilder = args.fFragBuilder;
SkString coords2D = fragBuilder->ensureFSCoords2D(args.fCoords, 0);
SkString coords2D = fragBuilder->ensureCoords2D(args.fTransformedCoords[0]);
fragBuilder->codeAppendf("%s = vec4(0, 0, 0, 0);", args.fOutputColor);

View File

@ -65,7 +65,7 @@ void GrGLMatrixConvolutionEffect::emitCode(EmitArgs& args) {
const char* bias = uniformHandler->getUniformCStr(fBiasUni);
GrGLSLFPFragmentBuilder* fragBuilder = args.fFragBuilder;
SkString coords2D = fragBuilder->ensureFSCoords2D(args.fCoords, 0);
SkString coords2D = fragBuilder->ensureCoords2D(args.fTransformedCoords[0]);
fragBuilder->codeAppend("vec4 sum = vec4(0, 0, 0, 0);");
fragBuilder->codeAppendf("vec2 coord = %s - %s * %s;", coords2D.c_str(), kernelOffset, imgInc);
fragBuilder->codeAppend("vec4 c;");

View File

@ -24,8 +24,8 @@ public:
fragBuilder->codeAppendf("%s = ", args.fOutputColor);
fragBuilder->appendTextureLookupAndModulate(args.fInputColor,
args.fTexSamplers[0],
args.fCoords[0].c_str(),
args.fCoords[0].getType(),
args.fTransformedCoords[0].c_str(),
args.fTransformedCoords[0].getType(),
&colorSpaceHelper);
fragBuilder->codeAppend(";");
}

View File

@ -191,7 +191,7 @@ void GrGLTextureDomainEffect::emitCode(EmitArgs& args) {
const GrTextureDomain& domain = textureDomainEffect.textureDomain();
GrGLSLFPFragmentBuilder* fragBuilder = args.fFragBuilder;
SkString coords2D = fragBuilder->ensureFSCoords2D(args.fCoords, 0);
SkString coords2D = fragBuilder->ensureCoords2D(args.fTransformedCoords[0]);
fGLDomain.sampleTexture(fragBuilder,
args.fUniformHandler,
args.fGLSLCaps,

View File

@ -108,17 +108,20 @@ public:
kMat44f_GrSLType, kDefault_GrSLPrecision,
"ColorSpaceMatrix", &colorSpaceMatrix);
fragBuilder->codeAppendf("%s = vec4(", args.fOutputColor);
fragBuilder->appendTextureLookup(args.fTexSamplers[0], args.fCoords[0].c_str(),
args.fCoords[0].getType());
fragBuilder->appendTextureLookup(args.fTexSamplers[0],
args.fTransformedCoords[0].c_str(),
args.fTransformedCoords[0].getType());
fragBuilder->codeAppend(".r,");
fragBuilder->appendTextureLookup(args.fTexSamplers[1], args.fCoords[1].c_str(),
args.fCoords[1].getType());
fragBuilder->appendTextureLookup(args.fTexSamplers[1],
args.fTransformedCoords[1].c_str(),
args.fTransformedCoords[1].getType());
if (effect.fNV12) {
fragBuilder->codeAppendf(".rg,");
} else {
fragBuilder->codeAppend(".r,");
fragBuilder->appendTextureLookup(args.fTexSamplers[2], args.fCoords[2].c_str(),
args.fCoords[2].getType());
fragBuilder->appendTextureLookup(args.fTexSamplers[2],
args.fTransformedCoords[2].c_str(),
args.fTransformedCoords[2].getType());
fragBuilder->codeAppendf(".g,");
}
fragBuilder->codeAppendf("1.0) * %s;", colorSpaceMatrix);

View File

@ -82,11 +82,11 @@ void GrGLSLFragmentProcessor::internalEmitChild(int childIndex, const char* inpu
firstTextureAt += args.fFp.childProcessor(i).numTextures();
firstBufferAt += args.fFp.childProcessor(i).numBuffers();
}
GrGLSLTransformedCoordsArray childCoords;
SkTArray<GrShaderVar> childCoords;
const SamplerHandle* childTexSamplers = nullptr;
const SamplerHandle* childBufferSamplers = nullptr;
if (childProc.numTransforms() > 0) {
childCoords.push_back_n(childProc.numTransforms(), &args.fCoords[firstCoordAt]);
childCoords.push_back_n(childProc.numTransforms(), &args.fTransformedCoords[firstCoordAt]);
}
if (childProc.numTextures() > 0) {
childTexSamplers = &args.fTexSamplers[firstTextureAt];

View File

@ -9,7 +9,7 @@
#define GrGLSLFragmentProcessor_DEFINED
#include "GrFragmentProcessor.h"
#include "glsl/GrGLSLProcessorTypes.h"
#include "GrShaderVar.h"
#include "glsl/GrGLSLProgramDataManager.h"
#include "glsl/GrGLSLSampler.h"
@ -37,21 +37,27 @@ public:
shader will be in its own block ({}) and so locally scoped names will not collide across
stages.
@param builder Interface used to emit code in the shaders.
@param processor The processor that generated this program stage.
@param key The key that was computed by GenKey() from the generating GrProcessor.
@param outputColor A predefined vec4 in the FS in which the stage should place its output
color (or coverage).
@param inputColor A vec4 that holds the input color to the stage in the FS. This may be
nullptr in which case the implied input is solid white (all ones).
TODO: Better system for communicating optimization info (e.g. input
color is solid white, trans black, known to be opaque, etc.) that allows
the processor to communicate back similar known info about its output.
@param samplers Contains one entry for each GrTextureAccess of the GrProcessor. These
can be passed to the builder to emit texture reads in the generated
code.
@param fragBuilder Interface used to emit code in the shaders.
@param fp The processor that generated this program stage.
@param key The key that was computed by GenKey() from the generating
GrProcessor.
@param outputColor A predefined vec4 in the FS in which the stage should place its
output color (or coverage).
@param inputColor A vec4 that holds the input color to the stage in the FS. This may
be nullptr in which case the implied input is solid white (all
ones). TODO: Better system for communicating optimization info
(e.g. input color is solid white, trans black, known to be opaque,
etc.) that allows the processor to communicate back similar known
info about its output.
@param transformedCoords Fragment shader variables containing the coords computed using
each of the GrFragmentProcessor's Coord Transforms.
@param texSamplers Contains one entry for each GrTextureAccess of the GrProcessor.
These can be passed to the builder to emit texture reads in the
generated code.
@param bufferSamplers Contains one entry for each GrBufferAccess of the GrProcessor.
These can be passed to the builder to emit buffer reads in the
generated code.
*/
struct EmitArgs {
EmitArgs(GrGLSLFPFragmentBuilder* fragBuilder,
GrGLSLUniformHandler* uniformHandler,
@ -59,7 +65,7 @@ public:
const GrFragmentProcessor& fp,
const char* outputColor,
const char* inputColor,
const GrGLSLTransformedCoordsArray& coords,
const SkTArray<GrShaderVar>& transformedCoords,
const SamplerHandle* texSamplers,
const SamplerHandle* bufferSamplers,
bool gpImplementsDistanceVector)
@ -69,17 +75,17 @@ public:
, fFp(fp)
, fOutputColor(outputColor)
, fInputColor(inputColor)
, fCoords(coords)
, fTransformedCoords(transformedCoords)
, fTexSamplers(texSamplers)
, fBufferSamplers(bufferSamplers)
, fGpImplementsDistanceVector(gpImplementsDistanceVector){}
, fGpImplementsDistanceVector(gpImplementsDistanceVector) {}
GrGLSLFPFragmentBuilder* fFragBuilder;
GrGLSLUniformHandler* fUniformHandler;
const GrGLSLCaps* fGLSLCaps;
const GrFragmentProcessor& fFp;
const char* fOutputColor;
const char* fInputColor;
const GrGLSLTransformedCoordsArray& fCoords;
const SkTArray<GrShaderVar>& fTransformedCoords;
const SamplerHandle* fTexSamplers;
const SamplerHandle* fBufferSamplers;
bool fGpImplementsDistanceVector;

View File

@ -125,19 +125,16 @@ bool GrGLSLFragmentShaderBuilder::enableFeature(GLSLFeature feature) {
}
}
SkString GrGLSLFragmentShaderBuilder::ensureFSCoords2D(const GrGLSLTransformedCoordsArray& coords,
int index) {
if (kVec3f_GrSLType != coords[index].getType()) {
SkASSERT(kVec2f_GrSLType == coords[index].getType());
return coords[index].getName();
SkString GrGLSLFragmentShaderBuilder::ensureCoords2D(const GrShaderVar& coords) {
if (kVec3f_GrSLType != coords.getType()) {
SkASSERT(kVec2f_GrSLType == coords.getType());
return coords.getName();
}
SkString coords2D("coords2D");
if (0 != index) {
coords2D.appendf("_%i", index);
}
this->codeAppendf("\tvec2 %s = %s.xy / %s.z;",
coords2D.c_str(), coords[index].c_str(), coords[index].c_str());
SkString coords2D;
coords2D.printf("%s_ensure2D", coords.c_str());
this->codeAppendf("\tvec2 %s = %s.xy / %s.z;", coords2D.c_str(), coords.c_str(),
coords.c_str());
return coords2D;
}

View File

@ -11,7 +11,6 @@
#include "GrGLSLShaderBuilder.h"
#include "GrProcessor.h"
#include "glsl/GrGLSLProcessorTypes.h"
class GrRenderTarget;
class GrGLSLVarying;
@ -43,10 +42,11 @@ public:
/**
* This returns a variable name to access the 2D, perspective correct version of the coords in
* the fragment shader. If the coordinates at index are 3-dimensional, it immediately emits a
* perspective divide into the fragment shader (xy / z) to convert them to 2D.
* the fragment shader. The passed in coordinates must either be of type kVec2f or kVec3f. If
* the coordinates are 3-dimensional, it a perspective divide into is emitted into the
* fragment shader (xy / z) to convert them to 2D.
*/
virtual SkString ensureFSCoords2D(const GrGLSLTransformedCoordsArray& coords, int index) = 0;
virtual SkString ensureCoords2D(const GrShaderVar&) = 0;
/** Returns a variable name that represents the position of the fragment in the FS. The position
@ -167,8 +167,7 @@ public:
// Shared GrGLSLFragmentBuilder interface.
bool enableFeature(GLSLFeature) override;
virtual SkString ensureFSCoords2D(const GrGLSLTransformedCoordsArray& coords,
int index) override;
virtual SkString ensureCoords2D(const GrShaderVar&) override;
const char* fragmentPosition() override;
const char* distanceVectorName() const override;

View File

@ -9,7 +9,6 @@
#include "GrCoordTransform.h"
#include "glsl/GrGLSLFragmentShaderBuilder.h"
#include "glsl/GrGLSLProcessorTypes.h"
#include "glsl/GrGLSLUniformHandler.h"
#include "glsl/GrGLSLVarying.h"
#include "glsl/GrGLSLVertexShaderBuilder.h"

View File

@ -9,7 +9,6 @@
#define GrGLSLPrimitiveProcessor_DEFINED
#include "GrPrimitiveProcessor.h"
#include "glsl/GrGLSLProcessorTypes.h"
#include "glsl/GrGLSLProgramDataManager.h"
#include "glsl/GrGLSLSampler.h"
@ -31,7 +30,7 @@ public:
typedef SkSTArray<2, const GrCoordTransform*, true> ProcCoords;
typedef SkSTArray<8, ProcCoords> TransformsIn;
typedef SkSTArray<8, GrGLSLTransformedCoordsArray> TransformsOut;
typedef SkSTArray<8, SkTArray<GrShaderVar>> TransformsOut;
struct EmitArgs {
EmitArgs(GrGLSLVertexBuilder* vertBuilder,

View File

@ -1,20 +0,0 @@
/*
* Copyright 2015 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef GrGLSLProcessorTypes_DEFINED
#define GrGLSLProcessorTypes_DEFINED
#include "GrShaderVar.h"
/**
* These are meant to only be used by GrGLSL*Processors so they can add transformed coordinates
* to their shader code.
*/
typedef GrShaderVar GrGLSLTransformedCoords;
typedef SkTArray<GrShaderVar> GrGLSLTransformedCoordsArray;
#endif