| OLD | NEW | 
|---|
| 1 /* | 1 /* | 
| 2  * Copyright 2015 Google Inc. | 2  * Copyright 2015 Google Inc. | 
| 3  * | 3  * | 
| 4  * Use of this source code is governed by a BSD-style license that can be | 4  * Use of this source code is governed by a BSD-style license that can be | 
| 5  * found in the LICENSE file. | 5  * found in the LICENSE file. | 
| 6  */ | 6  */ | 
| 7 | 7 | 
| 8 #ifndef GrGLSLProgramBuilder_DEFINED | 8 #ifndef GrGLSLProgramBuilder_DEFINED | 
| 9 #define GrGLSLProgramBuilder_DEFINED | 9 #define GrGLSLProgramBuilder_DEFINED | 
| 10 | 10 | 
| (...skipping 23 matching lines...) Expand all  Loading... | 
| 34     virtual const GrCaps* caps() const = 0; | 34     virtual const GrCaps* caps() const = 0; | 
| 35     virtual const GrGLSLCaps* glslCaps() const = 0; | 35     virtual const GrGLSLCaps* glslCaps() const = 0; | 
| 36 | 36 | 
| 37     const GrPrimitiveProcessor& primitiveProcessor() const { return fPrimProc; } | 37     const GrPrimitiveProcessor& primitiveProcessor() const { return fPrimProc; } | 
| 38     const GrPipeline& pipeline() const { return fPipeline; } | 38     const GrPipeline& pipeline() const { return fPipeline; } | 
| 39     const GrProgramDesc& desc() const { return fDesc; } | 39     const GrProgramDesc& desc() const { return fDesc; } | 
| 40     const GrProgramDesc::KeyHeader& header() const { return fDesc.header(); } | 40     const GrProgramDesc::KeyHeader& header() const { return fDesc.header(); } | 
| 41 | 41 | 
| 42     void appendUniformDecls(GrShaderFlags visibility, SkString*) const; | 42     void appendUniformDecls(GrShaderFlags visibility, SkString*) const; | 
| 43 | 43 | 
| 44     typedef GrGLSLUniformHandler::SamplerHandle SamplerHandle; |  | 
| 45 |  | 
| 46     const GrGLSLSampler& getSampler(SamplerHandle handle) const; |  | 
| 47 |  | 
| 48     // Handles for program uniforms (other than per-effect uniforms) | 44     // Handles for program uniforms (other than per-effect uniforms) | 
| 49     struct BuiltinUniformHandles { | 45     struct BuiltinUniformHandles { | 
| 50         UniformHandle       fRTAdjustmentUni; | 46         UniformHandle       fRTAdjustmentUni; | 
| 51 | 47 | 
| 52         // We use the render target height to provide a y-down frag coord when s
     pecifying | 48         // We use the render target height to provide a y-down frag coord when s
     pecifying | 
| 53         // origin_upper_left is not supported. | 49         // origin_upper_left is not supported. | 
| 54         UniformHandle       fRTHeightUni; | 50         UniformHandle       fRTHeightUni; | 
| 55     }; | 51     }; | 
| 56 | 52 | 
| 57     // Used to add a uniform in the vertex shader for transforming into normaliz
     ed device space. | 53     // Used to add a uniform in the vertex shader for transforming into normaliz
     ed device space. | 
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 101                                   const GrProgramDesc&); | 97                                   const GrProgramDesc&); | 
| 102 | 98 | 
| 103     void addFeature(GrShaderFlags shaders, uint32_t featureBit, const char* exte
     nsionName); | 99     void addFeature(GrShaderFlags shaders, uint32_t featureBit, const char* exte
     nsionName); | 
| 104 | 100 | 
| 105     bool emitAndInstallProcs(GrGLSLExpr4* inputColor, GrGLSLExpr4* inputCoverage
     ); | 101     bool emitAndInstallProcs(GrGLSLExpr4* inputColor, GrGLSLExpr4* inputCoverage
     ); | 
| 106 | 102 | 
| 107     void cleanupFragmentProcessors(); | 103     void cleanupFragmentProcessors(); | 
| 108 | 104 | 
| 109     void finalizeShaders(); | 105     void finalizeShaders(); | 
| 110 | 106 | 
|  | 107     SkTArray<UniformHandle> fSamplerUniforms; | 
|  | 108 | 
| 111 private: | 109 private: | 
| 112     // reset is called by program creator between each processor's emit code.  I
     t increments the | 110     // reset is called by program creator between each processor's emit code.  I
     t increments the | 
| 113     // stage offset for variable name mangling, and also ensures verfication var
     iables in the | 111     // stage offset for variable name mangling, and also ensures verfication var
     iables in the | 
| 114     // fragment shader are cleared. | 112     // fragment shader are cleared. | 
| 115     void reset() { | 113     void reset() { | 
| 116         this->addStage(); | 114         this->addStage(); | 
| 117         SkDEBUGCODE(fFS.resetVerification();) | 115         SkDEBUGCODE(fFS.resetVerification();) | 
| 118     } | 116     } | 
| 119     void addStage() { fStageIndex++; } | 117     void addStage() { fStageIndex++; } | 
| 120 | 118 | 
| (...skipping 20 matching lines...) Expand all  Loading... | 
| 141     void emitAndInstallFragProcs(int procOffset, int numProcs, GrGLSLExpr4* inOu
     t); | 139     void emitAndInstallFragProcs(int procOffset, int numProcs, GrGLSLExpr4* inOu
     t); | 
| 142     void emitAndInstallFragProc(const GrFragmentProcessor&, | 140     void emitAndInstallFragProc(const GrFragmentProcessor&, | 
| 143                                 int index, | 141                                 int index, | 
| 144                                 const GrGLSLExpr4& input, | 142                                 const GrGLSLExpr4& input, | 
| 145                                 GrGLSLExpr4* output); | 143                                 GrGLSLExpr4* output); | 
| 146     void emitAndInstallXferProc(const GrXferProcessor&, | 144     void emitAndInstallXferProc(const GrXferProcessor&, | 
| 147                                 const GrGLSLExpr4& colorIn, | 145                                 const GrGLSLExpr4& colorIn, | 
| 148                                 const GrGLSLExpr4& coverageIn, | 146                                 const GrGLSLExpr4& coverageIn, | 
| 149                                 bool ignoresCoverage, | 147                                 bool ignoresCoverage, | 
| 150                                 GrPixelLocalStorageState plsState); | 148                                 GrPixelLocalStorageState plsState); | 
| 151 |  | 
| 152     void emitSamplers(const GrProcessor& processor, | 149     void emitSamplers(const GrProcessor& processor, | 
| 153                       SkTArray<SamplerHandle>* outTexSamplers, | 150                       GrGLSLSampler::SamplerArray* outTexSamplers, | 
| 154                       SkTArray<SamplerHandle>* outBufferSamplers); | 151                       GrGLSLSampler::SamplerArray* outBufferSamplers); | 
| 155     void emitSampler(GrSLType samplerType, | 152     void emitSampler(GrSLType samplerType, | 
| 156                      GrPixelConfig, | 153                      GrPixelConfig, | 
| 157                      const char* name, | 154                      const char* name, | 
| 158                      GrShaderFlags visibility, | 155                      GrShaderFlags visibility, | 
| 159                      SkTArray<SamplerHandle>* outSamplers); | 156                      GrGLSLSampler::SamplerArray* outSamplers); | 
| 160     void emitFSOutputSwizzle(bool hasSecondaryOutput); | 157     void emitFSOutputSwizzle(bool hasSecondaryOutput); | 
| 161     bool checkSamplerCounts(); | 158     bool checkSamplerCounts(); | 
| 162 | 159 | 
| 163 #ifdef SK_DEBUG | 160 #ifdef SK_DEBUG | 
| 164     void verify(const GrPrimitiveProcessor&); | 161     void verify(const GrPrimitiveProcessor&); | 
| 165     void verify(const GrXferProcessor&); | 162     void verify(const GrXferProcessor&); | 
| 166     void verify(const GrFragmentProcessor&); | 163     void verify(const GrFragmentProcessor&); | 
| 167 #endif | 164 #endif | 
| 168 | 165 | 
| 169     GrGLSLPrimitiveProcessor::TransformsIn     fCoordTransforms; | 166     GrGLSLPrimitiveProcessor::TransformsIn     fCoordTransforms; | 
| 170     GrGLSLPrimitiveProcessor::TransformsOut    fOutCoords; | 167     GrGLSLPrimitiveProcessor::TransformsOut    fOutCoords; | 
| 171     int                                        fNumVertexSamplers; | 168     int                                        fNumVertexSamplers; | 
| 172     int                                        fNumGeometrySamplers; | 169     int                                        fNumGeometrySamplers; | 
| 173     int                                        fNumFragmentSamplers; | 170     int                                        fNumFragmentSamplers; | 
| 174 }; | 171 }; | 
| 175 | 172 | 
| 176 #endif | 173 #endif | 
| OLD | NEW | 
|---|