Chromium Code Reviews| Index: src/gpu/glsl/GrGLSLFragmentProcessor.h |
| diff --git a/src/gpu/glsl/GrGLSLFragmentProcessor.h b/src/gpu/glsl/GrGLSLFragmentProcessor.h |
| index f4a93ebe71c35b41b49a62466e22d204ca45ab58..6527662d695692aa7a9663c091ace14a522ed7f0 100644 |
| --- a/src/gpu/glsl/GrGLSLFragmentProcessor.h |
| +++ b/src/gpu/glsl/GrGLSLFragmentProcessor.h |
| @@ -33,6 +33,30 @@ public: |
| typedef GrGLSLProgramDataManager::UniformHandle UniformHandle; |
| typedef GrGLSLProgramDataManager::UniformHandle SamplerHandle; |
| + /** |
| + * When building a program from a GrPipeline this is used to provide the GrShaderVars that |
|
robertphillips
2016/09/15 20:44:30
the coords the resulting coords ?
bsalomon
2016/09/15 20:55:52
maybe will change to "contain the resulting transf
|
| + * contain the coords the resulting coords from each of a GrFragmentProcessor's |
| + * GrCoordTransforms. This allows the GrFragmentProcessor subclasses to refer to the transformed |
| + * coords in fragment code. |
| + */ |
| + class TransformedCoordVars { |
| + public: |
| + TransformedCoordVars(const GrFragmentProcessor* fp, const GrShaderVar* vars) |
| + : fFP(fp) |
| + , fTransformedVars(vars) {} |
| + |
| + const GrShaderVar& operator[] (int i) const { |
| + SkASSERT(i >= 0 && i < fFP->numCoordTransforms()); |
| + return fTransformedVars[i]; |
| + } |
| + |
| + TransformedCoordVars childTransforms(int childIdx) const; |
| + |
| + private: |
| + const GrFragmentProcessor* fFP; |
| + const GrShaderVar* fTransformedVars; |
| + }; |
| + |
| /** Called when the program stage should insert its code into the shaders. The code in each |
| shader will be in its own block ({}) and so locally scoped names will not collide across |
| stages. |
| @@ -50,7 +74,7 @@ public: |
| 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. |
| + each of the GrFragmentProcessor's GrCoordTransforms. |
| @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. |
| @@ -65,7 +89,7 @@ public: |
| const GrFragmentProcessor& fp, |
| const char* outputColor, |
| const char* inputColor, |
|
robertphillips
2016/09/15 20:44:30
const TransformedCoordVars& ?
bsalomon
2016/09/15 20:55:52
Sure, it is just 2 ptrs, but no reason it can't be
|
| - const SkTArray<GrShaderVar>& transformedCoords, |
| + const TransformedCoordVars transformedCoordVars, |
| const SamplerHandle* texSamplers, |
| const SamplerHandle* bufferSamplers, |
| bool gpImplementsDistanceVector) |
| @@ -75,7 +99,7 @@ public: |
| , fFp(fp) |
| , fOutputColor(outputColor) |
| , fInputColor(inputColor) |
| - , fTransformedCoords(transformedCoords) |
| + , fTransformedCoords(transformedCoordVars) |
| , fTexSamplers(texSamplers) |
| , fBufferSamplers(bufferSamplers) |
| , fGpImplementsDistanceVector(gpImplementsDistanceVector) {} |
| @@ -85,7 +109,7 @@ public: |
| const GrFragmentProcessor& fFp; |
| const char* fOutputColor; |
| const char* fInputColor; |
| - const SkTArray<GrShaderVar>& fTransformedCoords; |
| + const TransformedCoordVars fTransformedCoords; |
| const SamplerHandle* fTexSamplers; |
| const SamplerHandle* fBufferSamplers; |
| bool fGpImplementsDistanceVector; |