| Index: src/gpu/glsl/GrGLSLProgramBuilder.h
|
| diff --git a/src/gpu/glsl/GrGLSLProgramBuilder.h b/src/gpu/glsl/GrGLSLProgramBuilder.h
|
| index 2a3b48508c71c9837feff5b66df56dccb3fc34d5..964d320298fb7e1b10b4e905a978ee26ea329642 100644
|
| --- a/src/gpu/glsl/GrGLSLProgramBuilder.h
|
| +++ b/src/gpu/glsl/GrGLSLProgramBuilder.h
|
| @@ -12,14 +12,19 @@
|
| #include "GrGpu.h"
|
| #include "glsl/GrGLSLFragmentShaderBuilder.h"
|
| #include "glsl/GrGLSLGeometryShaderBuilder.h"
|
| +#include "glsl/GrGLSLPrimitiveProcessor.h"
|
| #include "glsl/GrGLSLProgramDataManager.h"
|
| #include "glsl/GrGLSLUniformHandler.h"
|
| +#include "glsl/GrGLSLTextureSampler.h"
|
| #include "glsl/GrGLSLVertexShaderBuilder.h"
|
| +#include "glsl/GrGLSLXferProcessor.h"
|
|
|
| class GrGLSLCaps;
|
| class GrGLSLShaderVar;
|
| class GrGLSLVaryingHandler;
|
|
|
| +typedef SkSTArray<8, GrGLSLFragmentProcessor*, true> GrGLSLFragProcs;
|
| +
|
| class GrGLSLProgramBuilder {
|
| public:
|
| typedef GrGpu::DrawArgs DrawArgs;
|
| @@ -28,6 +33,7 @@ public:
|
|
|
| virtual ~GrGLSLProgramBuilder() {}
|
|
|
| + virtual const GrCaps* caps() const = 0;
|
| virtual const GrGLSLCaps* glslCaps() const = 0;
|
|
|
| const GrPrimitiveProcessor& primitiveProcessor() const { return *fArgs.fPrimitiveProcessor; }
|
| @@ -76,8 +82,67 @@ public:
|
|
|
| BuiltinUniformHandles fUniformHandles;
|
|
|
| + GrGLSLPrimitiveProcessor* fGeometryProcessor;
|
| + GrGLSLXferProcessor* fXferProcessor;
|
| + GrGLSLFragProcs fFragmentProcessors;
|
| +
|
| protected:
|
| explicit GrGLSLProgramBuilder(const DrawArgs& args);
|
| +
|
| + bool emitAndInstallProcs(GrGLSLExpr4* inputColor, GrGLSLExpr4* inputCoverage, int maxTextures);
|
| +
|
| + void cleanupFragmentProcessors();
|
| +
|
| +private:
|
| + // reset is called by program creator between each processor's emit code. It increments the
|
| + // stage offset for variable name mangling, and also ensures verfication variables in the
|
| + // fragment shader are cleared.
|
| + void reset() {
|
| + this->addStage();
|
| + fFS.reset();
|
| + }
|
| + void addStage() { fStageIndex++; }
|
| +
|
| + class AutoStageAdvance {
|
| + public:
|
| + AutoStageAdvance(GrGLSLProgramBuilder* pb)
|
| + : fPB(pb) {
|
| + fPB->reset();
|
| + // Each output to the fragment processor gets its own code section
|
| + fPB->fFS.nextStage();
|
| + }
|
| + ~AutoStageAdvance() {}
|
| + private:
|
| + GrGLSLProgramBuilder* fPB;
|
| + };
|
| +
|
| + // Generates a possibly mangled name for a stage variable and writes it to the fragment shader.
|
| + // If GrGLSLExpr4 has a valid name then it will use that instead
|
| + void nameExpression(GrGLSLExpr4*, const char* baseName);
|
| +
|
| + void emitAndInstallPrimProc(const GrPrimitiveProcessor&,
|
| + GrGLSLExpr4* outputColor,
|
| + GrGLSLExpr4* outputCoverage);
|
| + void emitAndInstallFragProcs(int procOffset, int numProcs, GrGLSLExpr4* inOut);
|
| + void emitAndInstallFragProc(const GrFragmentProcessor&,
|
| + int index,
|
| + const GrGLSLExpr4& input,
|
| + GrGLSLExpr4* output);
|
| + void emitAndInstallXferProc(const GrXferProcessor&,
|
| + const GrGLSLExpr4& colorIn,
|
| + const GrGLSLExpr4& coverageIn,
|
| + bool ignoresCoverage);
|
| + void emitFSOutputSwizzle(bool hasSecondaryOutput);
|
| +
|
| + void verify(const GrPrimitiveProcessor&);
|
| + void verify(const GrXferProcessor&);
|
| + void verify(const GrFragmentProcessor&);
|
| +
|
| + virtual void emitSamplers(const GrProcessor& processor,
|
| + GrGLSLTextureSampler::TextureSamplerArray* outSamplers) = 0;
|
| +
|
| + GrGLSLPrimitiveProcessor::TransformsIn fCoordTransforms;
|
| + GrGLSLPrimitiveProcessor::TransformsOut fOutCoords;
|
| };
|
|
|
| #endif
|
|
|