| Index: src/gpu/gl/GrGLShaderBuilder.h
|
| diff --git a/src/gpu/gl/GrGLShaderBuilder.h b/src/gpu/gl/GrGLShaderBuilder.h
|
| index 2a14a1f6251912fb05aee2dab36637034e71170a..6b31e83b2a74bdb576e0a16d5617b792b9aa3b0f 100644
|
| --- a/src/gpu/gl/GrGLShaderBuilder.h
|
| +++ b/src/gpu/gl/GrGLShaderBuilder.h
|
| @@ -41,6 +41,7 @@ public:
|
| };
|
|
|
| typedef GrGLProgramDataManager::UniformHandle UniformHandle;
|
| + typedef GrGLProgramDataManager::VaryingHandle VaryingHandle;
|
|
|
| // Handles for program uniforms (other than per-effect uniforms)
|
| struct BuiltinUniformHandles {
|
| @@ -70,6 +71,13 @@ public:
|
| // name strings. Otherwise, we'd have to hand out copies.
|
| typedef GrTAllocator<UniformInfo> UniformInfoArray;
|
|
|
| + struct SeparableVaryingInfo {
|
| + GrGLShaderVar fVariable;
|
| + GrGLint fLocation;
|
| + };
|
| +
|
| + typedef GrTAllocator<SeparableVaryingInfo> SeparableVaryingInfoArray;
|
| +
|
| /** Generates a shader program.
|
| *
|
| * The program implements what is specified in the stages given as input.
|
| @@ -92,6 +100,9 @@ public:
|
| bool hasVertexShader() const { SkASSERT(fProgramID); return fHasVertexShader; }
|
| int getTexCoordSetCount() const { SkASSERT(fProgramID); return fTexCoordSetCnt; }
|
| const UniformInfoArray& getUniformInfos() const { return fUniforms; }
|
| + const SeparableVaryingInfoArray& getSeparableVaryingInfos() const {
|
| + return fSeparableVaryingInfos;
|
| + }
|
|
|
| virtual ~GrGLShaderBuilder() {}
|
|
|
| @@ -217,6 +228,8 @@ public:
|
|
|
| const GrGLContextInfo& ctxInfo() const;
|
|
|
| + GrGpuGL* gpu() const { return fGpu; }
|
| +
|
| /**
|
| * Helper for begining and ending a block in the fragment code. TODO: Make GrGLShaderBuilder
|
| * aware of all blocks and turn single \t's into the correct number of tabs (or spaces) so that
|
| @@ -239,13 +252,8 @@ public:
|
| protected:
|
| GrGLShaderBuilder(GrGpuGL*, const GrGLProgramDesc&);
|
|
|
| - GrGpuGL* gpu() const { return fGpu; }
|
| -
|
| const GrGLProgramDesc& desc() const { return fDesc; }
|
|
|
| - /** Add input/output variable declarations (i.e. 'varying') to the fragment shader. */
|
| - GrGLShaderVar& fsInputAppend() { return fFSInputs.push_back(); }
|
| -
|
| // Helper for emitEffects().
|
| void createAndEmitEffects(GrGLProgramEffectsBuilder*,
|
| const GrEffectStage* effectStages[],
|
| @@ -272,6 +280,10 @@ protected:
|
| bool fHasVertexShader;
|
| int fTexCoordSetCnt;
|
| GrGLuint fProgramID;
|
| +
|
| + VarArray fFSInputs;
|
| + SeparableVaryingInfoArray fSeparableVaryingInfos;
|
| +
|
| private:
|
| class CodeStage : SkNoncopyable {
|
| public:
|
| @@ -395,7 +407,6 @@ private:
|
| uint32_t fFSFeaturesAddedMask;
|
| SkString fFSFunctions;
|
| SkString fFSExtensions;
|
| - VarArray fFSInputs;
|
| VarArray fFSOutputs;
|
| UniformInfoArray fUniforms;
|
|
|
| @@ -438,6 +449,17 @@ public:
|
| const char** vsOutName = NULL,
|
| const char** fsInName = NULL);
|
|
|
| + /** Add a separable varying input variable to the current program.
|
| + * A separable varying (fragment shader input) is a varying that can be used also when vertex
|
| + * shaders are not used. With a vertex shader, the operation is same as with other
|
| + * varyings. Without a vertex shader, such as with NV_path_rendering, GL APIs are used to
|
| + * populate the variable. The APIs can refer to the variable through the returned handle.
|
| + */
|
| + VaryingHandle addSeparableVarying(GrSLType type,
|
| + const char* name,
|
| + const char** vsOutName,
|
| + const char** fsInName);
|
| +
|
| /** Returns a vertex attribute that represents the vertex position in the VS. This is the
|
| pre-matrix position and is commonly used by effects to compute texture coords via a matrix.
|
| */
|
|
|