remove proc key

BUG=skia:

Review URL: https://codereview.chromium.org/755363002
This commit is contained in:
joshualitt 2014-11-25 14:52:21 -08:00 committed by Commit bot
parent 7e225bdb1f
commit 267ce482b5
38 changed files with 13 additions and 168 deletions

View File

@ -48,31 +48,6 @@ private:
int fCount; // number of uint32_ts added to fData by the processor.
};
/**
* This class is used to pass the key that was created for a GrGLProcessor back to it
* when it emits code. It may allow the emit step to skip calculations that were
* performed when computing the key.
*/
class GrProcessorKey {
public:
GrProcessorKey(const uint32_t* key, int count) : fKey(key), fCount(count) {
SkASSERT(0 == reinterpret_cast<intptr_t>(key) % sizeof(uint32_t));
}
/** Gets the uint32_t values that the processor inserted into the key. */
uint32_t get32(int index) const {
SkASSERT(index >=0 && index < fCount);
return fKey[index];
}
/** Gets the number of uint32_t values that the processor inserted into the key. */
int count32() const { return fCount; }
private:
const uint32_t* fKey; // unowned ptr into the larger key.
int fCount; // number of uint32_ts inserted by the processor into its key.
};
/**
* Given a GrProcessor of a particular type, creates the corresponding graphics-backend-specific
* processor object. It also tracks equivalence of shaders generated via a key. The factory for an

View File

@ -816,7 +816,6 @@ public:
}
virtual void emitCode(GrGLFPBuilder* builder,
const GrFragmentProcessor& fp,
const GrProcessorKey& key,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray& coords,

View File

@ -123,7 +123,6 @@ public:
virtual void emitCode(GrGLFPBuilder*,
const GrFragmentProcessor&,
const GrProcessorKey&,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray&,
@ -146,7 +145,6 @@ GrGLAlphaThresholdEffect::GrGLAlphaThresholdEffect(const GrBackendProcessorFacto
void GrGLAlphaThresholdEffect::emitCode(GrGLFPBuilder* builder,
const GrFragmentProcessor&,
const GrProcessorKey& key,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray& coords,

View File

@ -256,7 +256,6 @@ public:
virtual void emitCode(GrGLFPBuilder*,
const GrFragmentProcessor&,
const GrProcessorKey&,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray&,
@ -362,7 +361,6 @@ GrGLArithmeticEffect::~GrGLArithmeticEffect() {
void GrGLArithmeticEffect::emitCode(GrGLFPBuilder* builder,
const GrFragmentProcessor& fp,
const GrProcessorKey& key,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray& coords,

View File

@ -673,7 +673,6 @@ public:
const GrProcessor&);
virtual void emitCode(GrGLFPBuilder*,
const GrFragmentProcessor&,
const GrProcessorKey&,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray&,
@ -714,7 +713,6 @@ void OutputRectBlurProfileLookup(GrGLFPFragmentBuilder* fsBuilder,
void GrGLRectBlurEffect::emitCode(GrGLFPBuilder* builder,
const GrFragmentProcessor&,
const GrProcessorKey& key,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray& coords,
@ -1035,7 +1033,6 @@ public:
virtual void emitCode(GrGLFPBuilder*,
const GrFragmentProcessor&,
const GrProcessorKey&,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray&,
@ -1057,7 +1054,6 @@ GrGLRRectBlurEffect::GrGLRRectBlurEffect(const GrBackendProcessorFactory& factor
void GrGLRRectBlurEffect::emitCode(GrGLFPBuilder* builder,
const GrFragmentProcessor&,
const GrProcessorKey&,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray&,

View File

@ -216,7 +216,6 @@ public:
virtual void emitCode(GrGLFPBuilder*,
const GrFragmentProcessor&,
const GrProcessorKey&,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray&,
@ -276,7 +275,6 @@ GrColorCubeEffect::GLProcessor::~GLProcessor() {
void GrColorCubeEffect::GLProcessor::emitCode(GrGLFPBuilder* builder,
const GrFragmentProcessor&,
const GrProcessorKey&,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray& coords,

View File

@ -223,7 +223,6 @@ public:
virtual void emitCode(GrGLFPBuilder* builder,
const GrFragmentProcessor& fp,
const GrProcessorKey&,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray&,

View File

@ -364,7 +364,6 @@ public:
virtual void emitCode(GrGLFPBuilder* builder,
const GrFragmentProcessor&,
const GrProcessorKey&,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray&,

View File

@ -306,7 +306,6 @@ public:
virtual void emitCode(GrGLFPBuilder*,
const GrFragmentProcessor&,
const GrProcessorKey&,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray&,
@ -540,7 +539,6 @@ GrGLDisplacementMapEffect::~GrGLDisplacementMapEffect() {
void GrGLDisplacementMapEffect::emitCode(GrGLFPBuilder* builder,
const GrFragmentProcessor&,
const GrProcessorKey& key,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray& coords,

View File

@ -1230,7 +1230,6 @@ public:
virtual void emitCode(GrGLFPBuilder*,
const GrFragmentProcessor&,
const GrProcessorKey&,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray&,
@ -1362,7 +1361,6 @@ GrGLLightingEffect::~GrGLLightingEffect() {
void GrGLLightingEffect::emitCode(GrGLFPBuilder* builder,
const GrFragmentProcessor&,
const GrProcessorKey& key,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray& coords,

View File

@ -85,7 +85,6 @@ public:
virtual void emitCode(GrGLFPBuilder* builder,
const GrFragmentProcessor&,
const GrProcessorKey&,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray&,

View File

@ -98,7 +98,6 @@ public:
virtual void emitCode(GrGLFPBuilder*,
const GrFragmentProcessor&,
const GrProcessorKey&,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray&,
@ -121,7 +120,6 @@ GrGLMagnifierEffect::GrGLMagnifierEffect(const GrBackendProcessorFactory& factor
void GrGLMagnifierEffect::emitCode(GrGLFPBuilder* builder,
const GrFragmentProcessor&,
const GrProcessorKey& key,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray& coords,

View File

@ -335,7 +335,6 @@ public:
virtual void emitCode(GrGLFPBuilder*,
const GrFragmentProcessor&,
const GrProcessorKey&,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray&,
@ -365,7 +364,6 @@ GrGLMorphologyEffect::GrGLMorphologyEffect(const GrBackendProcessorFactory& fact
void GrGLMorphologyEffect::emitCode(GrGLFPBuilder* builder,
const GrFragmentProcessor&,
const GrProcessorKey& key,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray& coords,

View File

@ -518,7 +518,6 @@ public:
virtual void emitCode(GrGLFPBuilder*,
const GrFragmentProcessor&,
const GrProcessorKey&,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray&,
@ -663,7 +662,6 @@ GrGLPerlinNoise::GrGLPerlinNoise(const GrBackendProcessorFactory& factory,
void GrGLPerlinNoise::emitCode(GrGLFPBuilder* builder,
const GrFragmentProcessor&,
const GrProcessorKey& key,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray& coords,

View File

@ -326,7 +326,6 @@ public:
virtual void emitCode(GrGLFPBuilder*,
const GrFragmentProcessor&,
const GrProcessorKey&,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray&,
@ -366,7 +365,6 @@ void GLColorTableEffect::setData(const GrGLProgramDataManager& pdm, const GrProc
void GLColorTableEffect::emitCode(GrGLFPBuilder* builder,
const GrFragmentProcessor&,
const GrProcessorKey&,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray&,

View File

@ -1046,7 +1046,7 @@ uint32_t GrGLGradientEffect::GenBaseGradientKey(const GrProcessor& processor) {
if (SkGradientShaderBase::kTwo_GpuColorType == e.getColorType()) {
key |= kTwoColorKey;
} else if (SkGradientShaderBase::kThree_GpuColorType == e.getColorType()){
} else if (SkGradientShaderBase::kThree_GpuColorType == e.getColorType()) {
key |= kThreeColorKey;
}

View File

@ -475,7 +475,6 @@ public:
virtual void emitCode(GrGLFPBuilder*,
const GrFragmentProcessor&,
const GrProcessorKey&,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray&,
@ -552,7 +551,6 @@ GrFragmentProcessor* GrLinearGradient::TestCreate(SkRandom* random,
void GrGLLinearGradient::emitCode(GrGLFPBuilder* builder,
const GrFragmentProcessor& fp,
const GrProcessorKey& key,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray& coords,

View File

@ -482,7 +482,6 @@ public:
virtual void emitCode(GrGLFPBuilder*,
const GrFragmentProcessor&,
const GrProcessorKey&,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray&,
@ -561,7 +560,6 @@ GrFragmentProcessor* GrRadialGradient::TestCreate(SkRandom* random,
void GrGLRadialGradient::emitCode(GrGLFPBuilder* builder,
const GrFragmentProcessor& fp,
const GrProcessorKey& key,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray& coords,

View File

@ -197,7 +197,6 @@ public:
virtual void emitCode(GrGLFPBuilder*,
const GrFragmentProcessor&,
const GrProcessorKey&,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray&,
@ -268,7 +267,6 @@ GrFragmentProcessor* GrSweepGradient::TestCreate(SkRandom* random,
void GrGLSweepGradient::emitCode(GrGLFPBuilder* builder,
const GrFragmentProcessor& fp,
const GrProcessorKey& key,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray& coords,

View File

@ -142,7 +142,6 @@ public:
virtual void emitCode(GrGLFPBuilder*,
const GrFragmentProcessor&,
const GrProcessorKey&,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray&,
@ -225,7 +224,6 @@ GLEdge2PtConicalEffect::GLEdge2PtConicalEffect(const GrBackendProcessorFactory&
void GLEdge2PtConicalEffect::emitCode(GrGLFPBuilder* builder,
const GrFragmentProcessor& fp,
const GrProcessorKey& key,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray& coords,
@ -423,7 +421,6 @@ public:
virtual void emitCode(GrGLFPBuilder*,
const GrFragmentProcessor&,
const GrProcessorKey&,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray&,
@ -506,7 +503,6 @@ GLFocalOutside2PtConicalEffect::GLFocalOutside2PtConicalEffect(const GrBackendPr
void GLFocalOutside2PtConicalEffect::emitCode(GrGLFPBuilder* builder,
const GrFragmentProcessor& fp,
const GrProcessorKey& key,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray& coords,
@ -632,7 +628,6 @@ public:
virtual void emitCode(GrGLFPBuilder*,
const GrFragmentProcessor&,
const GrProcessorKey&,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray&,
@ -712,7 +707,6 @@ GLFocalInside2PtConicalEffect::GLFocalInside2PtConicalEffect(const GrBackendProc
void GLFocalInside2PtConicalEffect::emitCode(GrGLFPBuilder* builder,
const GrFragmentProcessor& fp,
const GrProcessorKey& key,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray& coords,
@ -877,7 +871,6 @@ public:
virtual void emitCode(GrGLFPBuilder*,
const GrFragmentProcessor&,
const GrProcessorKey&,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray&,
@ -965,7 +958,6 @@ GLCircleInside2PtConicalEffect::GLCircleInside2PtConicalEffect(const GrBackendPr
void GLCircleInside2PtConicalEffect::emitCode(GrGLFPBuilder* builder,
const GrFragmentProcessor& fp,
const GrProcessorKey& key,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray& coords,
@ -1109,7 +1101,6 @@ public:
virtual void emitCode(GrGLFPBuilder*,
const GrFragmentProcessor&,
const GrProcessorKey&,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray&,
@ -1205,7 +1196,6 @@ GLCircleOutside2PtConicalEffect::GLCircleOutside2PtConicalEffect(const GrBackend
void GLCircleOutside2PtConicalEffect::emitCode(GrGLFPBuilder* builder,
const GrFragmentProcessor& fp,
const GrProcessorKey& key,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray& coords,

View File

@ -413,7 +413,6 @@ public:
virtual void emitCode(GrGLFPBuilder*,
const GrFragmentProcessor&,
const GrProcessorKey&,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray&,
@ -569,7 +568,6 @@ GrGLRadial2Gradient::GrGLRadial2Gradient(const GrBackendProcessorFactory& factor
void GrGLRadial2Gradient::emitCode(GrGLFPBuilder* builder,
const GrFragmentProcessor& fp,
const GrProcessorKey& key,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray& coords,

View File

@ -139,45 +139,6 @@ public:
// This should really only be used internally, base classes should return their own headers
const KeyHeader& header() const { return *this->atOffset<KeyHeader, kHeaderOffset>(); }
/** Used to provide effects' keys to their emitCode() function. */
class ProcKeyProvider {
public:
enum ProcessorType {
kGeometry_ProcessorType,
kFragment_ProcessorType,
};
ProcKeyProvider(const GrProgramDesc* desc, ProcessorType type, int effectOffset)
: fDesc(desc), fBaseIndex(0), fEffectOffset(effectOffset) {
switch (type) {
case kGeometry_ProcessorType:
// there can be only one
fBaseIndex = 0;
break;
case kFragment_ProcessorType:
fBaseIndex = desc->hasGeometryProcessor() ? 1 : 0;
break;
}
}
GrProcessorKey get(int index) const {
const uint16_t* offsetsAndLengths = reinterpret_cast<const uint16_t*>(
fDesc->fKey.begin() + fEffectOffset);
// We store two uint16_ts per effect, one for the offset to the effect's key and one for
// its length. Here we just need the offset.
uint16_t offset = offsetsAndLengths[2 * (fBaseIndex + index) + 0];
uint16_t length = offsetsAndLengths[2 * (fBaseIndex + index) + 1];
// Currently effects must add to the key in units of uint32_t.
SkASSERT(0 == (length % sizeof(uint32_t)));
return GrProcessorKey(reinterpret_cast<const uint32_t*>(fDesc->fKey.begin() + offset),
length / sizeof(uint32_t));
}
private:
const GrProgramDesc* fDesc;
int fBaseIndex;
int fEffectOffset;
};
// A struct to communicate descriptor information to the program descriptor builder
struct DescInfo {
int positionAttributeIndex() const {

View File

@ -26,7 +26,6 @@ public:
virtual void emitCode(GrGLFPBuilder*,
const GrFragmentProcessor&,
const GrProcessorKey&,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray&,
@ -56,7 +55,6 @@ GrGLBicubicEffect::GrGLBicubicEffect(const GrBackendProcessorFactory& factory, c
void GrGLBicubicEffect::emitCode(GrGLFPBuilder* builder,
const GrFragmentProcessor& effect,
const GrProcessorKey& key,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray& coords,

View File

@ -27,7 +27,6 @@ public:
virtual void emitCode(GrGLFPBuilder* builder,
const GrFragmentProcessor&,
const GrProcessorKey& key,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray& coords,

View File

@ -89,7 +89,6 @@ public:
virtual void emitCode(GrGLFPBuilder* builder,
const GrFragmentProcessor& fp,
const GrProcessorKey& key,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray&,
@ -113,7 +112,6 @@ GLAARectEffect::GLAARectEffect(const GrBackendProcessorFactory& factory,
void GLAARectEffect::emitCode(GrGLFPBuilder* builder,
const GrFragmentProcessor& fp,
const GrProcessorKey& key,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray&,
@ -183,7 +181,6 @@ public:
virtual void emitCode(GrGLFPBuilder* builder,
const GrFragmentProcessor& fp,
const GrProcessorKey& key,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray&,
@ -207,7 +204,6 @@ GrGLConvexPolyEffect::GrGLConvexPolyEffect(const GrBackendProcessorFactory& fact
void GrGLConvexPolyEffect::emitCode(GrGLFPBuilder* builder,
const GrFragmentProcessor& fp,
const GrProcessorKey& key,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray&,

View File

@ -21,7 +21,6 @@ public:
virtual void emitCode(GrGLFPBuilder*,
const GrFragmentProcessor&,
const GrProcessorKey&,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray&,
@ -57,7 +56,6 @@ GrGLConvolutionEffect::GrGLConvolutionEffect(const GrBackendProcessorFactory& fa
void GrGLConvolutionEffect::emitCode(GrGLFPBuilder* builder,
const GrFragmentProcessor&,
const GrProcessorKey& key,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray& coords,

View File

@ -72,7 +72,6 @@ public:
virtual void emitCode(GrGLFPBuilder* builder,
const GrFragmentProcessor& fp,
const GrProcessorKey& key,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray&,
@ -89,7 +88,6 @@ GLDitherEffect::GLDitherEffect(const GrBackendProcessorFactory& factory,
void GLDitherEffect::emitCode(GrGLFPBuilder* builder,
const GrFragmentProcessor& fp,
const GrProcessorKey& key,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray&,

View File

@ -17,7 +17,6 @@ public:
const GrProcessor&);
virtual void emitCode(GrGLFPBuilder*,
const GrFragmentProcessor&,
const GrProcessorKey&,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray&,
@ -53,7 +52,6 @@ GrGLMatrixConvolutionEffect::GrGLMatrixConvolutionEffect(const GrBackendProcesso
void GrGLMatrixConvolutionEffect::emitCode(GrGLFPBuilder* builder,
const GrFragmentProcessor& fp,
const GrProcessorKey& key,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray& coords,

View File

@ -103,7 +103,6 @@ public:
virtual void emitCode(GrGLFPBuilder* builder,
const GrFragmentProcessor& fp,
const GrProcessorKey& key,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray&,
@ -129,7 +128,6 @@ GLCircleEffect::GLCircleEffect(const GrBackendProcessorFactory& factory,
void GLCircleEffect::emitCode(GrGLFPBuilder* builder,
const GrFragmentProcessor& fp,
const GrProcessorKey& key,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray&,
@ -278,7 +276,6 @@ public:
virtual void emitCode(GrGLFPBuilder* builder,
const GrFragmentProcessor& fp,
const GrProcessorKey& key,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray&,
@ -304,7 +301,6 @@ GLEllipseEffect::GLEllipseEffect(const GrBackendProcessorFactory& factory,
void GLEllipseEffect::emitCode(GrGLFPBuilder* builder,
const GrFragmentProcessor& fp,
const GrProcessorKey& key,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray&,

View File

@ -139,7 +139,6 @@ public:
virtual void emitCode(GrGLFPBuilder* builder,
const GrFragmentProcessor& fp,
const GrProcessorKey& key,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray&,
@ -163,12 +162,11 @@ GLCircularRRectEffect::GLCircularRRectEffect(const GrBackendProcessorFactory& fa
}
void GLCircularRRectEffect::emitCode(GrGLFPBuilder* builder,
const GrFragmentProcessor& fp,
const GrProcessorKey& key,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray&,
const TextureSamplerArray& samplers) {
const GrFragmentProcessor& fp,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray&,
const TextureSamplerArray& samplers) {
const CircularRRectEffect& crre = fp.cast<CircularRRectEffect>();
const char *rectName;
const char *radiusPlusHalfName;
@ -494,7 +492,6 @@ public:
virtual void emitCode(GrGLFPBuilder* builder,
const GrFragmentProcessor& effect,
const GrProcessorKey& key,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray&,
@ -519,7 +516,6 @@ GLEllipticalRRectEffect::GLEllipticalRRectEffect(const GrBackendProcessorFactory
void GLEllipticalRRectEffect::emitCode(GrGLFPBuilder* builder,
const GrFragmentProcessor& effect,
const GrProcessorKey& key,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray&,

View File

@ -22,7 +22,6 @@ public:
virtual void emitCode(GrGLFPBuilder* builder,
const GrFragmentProcessor& fp,
const GrProcessorKey& key,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray& coords,

View File

@ -172,7 +172,6 @@ public:
virtual void emitCode(GrGLFPBuilder*,
const GrFragmentProcessor&,
const GrProcessorKey&,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray&,
@ -194,7 +193,6 @@ GrGLTextureDomainEffect::GrGLTextureDomainEffect(const GrBackendProcessorFactory
void GrGLTextureDomainEffect::emitCode(GrGLFPBuilder* builder,
const GrFragmentProcessor& fp,
const GrProcessorKey& key,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray& coords,

View File

@ -48,7 +48,6 @@ public:
virtual void emitCode(GrGLFPBuilder* builder,
const GrFragmentProcessor&,
const GrProcessorKey&,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray& coords,

View File

@ -25,14 +25,12 @@ public:
struct EmitArgs {
EmitArgs(GrGLGPBuilder* pb,
const GrGeometryProcessor& gp,
const GrProcessorKey& key,
const char* output,
const char* input,
const TextureSamplerArray& samplers)
: fPB(pb), fGP(gp), fKey(key), fOutput(output), fInput(input), fSamplers(samplers) {}
: fPB(pb), fGP(gp), fOutput(output), fInput(input), fSamplers(samplers) {}
GrGLGPBuilder* fPB;
const GrGeometryProcessor& fGP;
const GrProcessorKey& fKey;
const char* fOutput;
const char* fInput;
const TextureSamplerArray& fSamplers;

View File

@ -116,7 +116,6 @@ public:
*/
virtual void emitCode(GrGLFPBuilder* builder,
const GrFragmentProcessor& effect,
const GrProcessorKey& key,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray& coords,

View File

@ -250,24 +250,18 @@ void GrGLProgramBuilder::emitAndInstallProcs(GrGLSLExpr4* inputColor,
if (fOptState.hasGeometryProcessor()) {
const GrGeometryProcessor& gp = *fOptState.getGeometryProcessor();
fVS.emitAttributes(gp);
ProcKeyProvider keyProvider(&fDesc,
ProcKeyProvider::kGeometry_ProcessorType,
GrGLProgramDescBuilder::kProcessorKeyOffsetsAndLengthOffset);
GrGLSLExpr4 output;
this->emitAndInstallProc<GrGeometryProcessor>(gp, 0, keyProvider, *inputCoverage, &output);
this->emitAndInstallProc<GrGeometryProcessor>(gp, 0, *inputCoverage, &output);
*inputCoverage = output;
}
this->emitAndInstallFragProcs(fOptState.numColorStages(), numProcs, inputCoverage);
}
void GrGLProgramBuilder::emitAndInstallFragProcs(int procOffset, int numProcs, GrGLSLExpr4* inOut) {
ProcKeyProvider keyProvider(&fDesc,
ProcKeyProvider::kFragment_ProcessorType,
GrGLProgramDescBuilder::kProcessorKeyOffsetsAndLengthOffset);
for (int e = procOffset; e < numProcs; ++e) {
GrGLSLExpr4 output;
const GrPendingFragmentStage& stage = fOptState.getFragmentStage(e);
this->emitAndInstallProc<GrPendingFragmentStage>(stage, e, keyProvider, *inOut, &output);
this->emitAndInstallProc<GrPendingFragmentStage>(stage, e, *inOut, &output);
*inOut = output;
}
}
@ -277,7 +271,6 @@ void GrGLProgramBuilder::emitAndInstallFragProcs(int procOffset, int numProcs, G
template <class Proc>
void GrGLProgramBuilder::emitAndInstallProc(const Proc& proc,
int index,
const ProcKeyProvider& keyProvider,
const GrGLSLExpr4& input,
GrGLSLExpr4* output) {
// Program builders have a bit of state we need to clear with each effect
@ -299,14 +292,12 @@ void GrGLProgramBuilder::emitAndInstallProc(const Proc& proc,
openBrace.printf("{ // Stage %d, %s\n", fStageIndex, proc.name());
fFS.codeAppend(openBrace.c_str());
this->emitAndInstallProc(proc, keyProvider.get(index), output->c_str(),
input.isOnes() ? NULL : input.c_str());
this->emitAndInstallProc(proc, output->c_str(), input.isOnes() ? NULL : input.c_str());
fFS.codeAppend("}");
}
void GrGLProgramBuilder::emitAndInstallProc(const GrPendingFragmentStage& fs,
const GrProcessorKey& key,
const char* outColor,
const char* inColor) {
GrGLInstalledFragProc* ifp = SkNEW_ARGS(GrGLInstalledFragProc, (fVS.hasLocalCoords()));
@ -321,7 +312,7 @@ void GrGLProgramBuilder::emitAndInstallProc(const GrPendingFragmentStage& fs,
SkSTArray<2, GrGLProcessor::TransformedCoords> coords(fp.numTransforms());
this->emitTransforms(fs, &coords, ifp);
ifp->fGLProc->emitCode(this, fp, key, outColor, inColor, coords, samplers);
ifp->fGLProc->emitCode(this, fp, outColor, inColor, coords, samplers);
// We have to check that effects and the code they emit are consistent, ie if an effect
// asks for dst color, then the emit code needs to follow suit
@ -330,7 +321,6 @@ void GrGLProgramBuilder::emitAndInstallProc(const GrPendingFragmentStage& fs,
}
void GrGLProgramBuilder::emitAndInstallProc(const GrGeometryProcessor& gp,
const GrProcessorKey& key,
const char* outCoverage,
const char* inCoverage) {
SkASSERT(!fGeometryProcessor);
@ -341,7 +331,7 @@ void GrGLProgramBuilder::emitAndInstallProc(const GrGeometryProcessor& gp,
SkSTArray<4, GrGLProcessor::TextureSampler> samplers(gp.numTextures());
this->emitSamplers(gp, &samplers, fGeometryProcessor);
GrGLGeometryProcessor::EmitArgs args(this, gp, key, outCoverage, inCoverage, samplers);
GrGLGeometryProcessor::EmitArgs args(this, gp, outCoverage, inCoverage, samplers);
fGeometryProcessor->fGLProc->emitCode(args);
// We have to check that effects and the code they emit are consistent, ie if an effect

View File

@ -223,7 +223,6 @@ public:
};
protected:
typedef GrProgramDesc::ProcKeyProvider ProcKeyProvider;
typedef GrGLProgramDataManager::UniformInfo UniformInfo;
typedef GrGLProgramDataManager::UniformInfoArray UniformInfoArray;
@ -249,17 +248,14 @@ protected:
template <class Proc>
void emitAndInstallProc(const Proc&,
int index,
const ProcKeyProvider&,
const GrGLSLExpr4& input,
GrGLSLExpr4* output);
// these emit functions help to keep the createAndEmitProcessors template general
void emitAndInstallProc(const GrPendingFragmentStage&,
const GrProcessorKey&,
const char* outColor,
const char* inColor);
void emitAndInstallProc(const GrGeometryProcessor&,
const GrProcessorKey&,
const char* outCoverage,
const char* inCoverage);
void verify(const GrGeometryProcessor&);

View File

@ -74,15 +74,10 @@ public:
virtual void emitCode(GrGLFPBuilder* builder,
const GrFragmentProcessor& fp,
const GrProcessorKey& key,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray&,
const TextureSamplerArray&) {
for (uint32_t i = 0; i < kMaxKeySize; i++) {
SkASSERT(key.get32(i) == i);
}
}
const TextureSamplerArray&) {}
static void GenKey(const GrProcessor& processor, const GrGLCaps&, GrProcessorKeyBuilder* b) {
for (uint32_t i = 0; i < kMaxKeySize; i++) {