| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 | 8 |
| 9 #ifndef GrGLProgram_DEFINED | 9 #ifndef GrGLProgram_DEFINED |
| 10 #define GrGLProgram_DEFINED | 10 #define GrGLProgram_DEFINED |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 }; | 89 }; |
| 90 | 90 |
| 91 /** | 91 /** |
| 92 * This function uploads uniforms, calls each GrGL*Processor's setData, and
retrieves the | 92 * This function uploads uniforms, calls each GrGL*Processor's setData, and
retrieves the |
| 93 * textures that need to be bound on each unit. It is the caller's responsib
ility to ensure | 93 * textures that need to be bound on each unit. It is the caller's responsib
ility to ensure |
| 94 * the program is bound before calling, and to bind the outgoing textures to
their respective | 94 * the program is bound before calling, and to bind the outgoing textures to
their respective |
| 95 * units upon return. (Each index in the array corresponds to its matching G
L texture unit.) | 95 * units upon return. (Each index in the array corresponds to its matching G
L texture unit.) |
| 96 */ | 96 */ |
| 97 void setData(const GrPrimitiveProcessor&, const GrPipeline&); | 97 void setData(const GrPrimitiveProcessor&, const GrPipeline&); |
| 98 | 98 |
| 99 /** |
| 100 * This function retrieves the textures that need to be used by each GrGL*Pr
ocessor, and |
| 101 * ensures that any textures requiring mipmaps have their mipmaps correctly
built. |
| 102 */ |
| 103 void generateMipmaps(const GrPrimitiveProcessor&, const GrPipeline&); |
| 104 |
| 99 protected: | 105 protected: |
| 100 typedef GrGLSLProgramDataManager::UniformHandle UniformHandle; | 106 typedef GrGLSLProgramDataManager::UniformHandle UniformHandle; |
| 101 typedef GrGLProgramDataManager::UniformInfoArray UniformInfoArray; | 107 typedef GrGLProgramDataManager::UniformInfoArray UniformInfoArray; |
| 102 typedef GrGLProgramDataManager::VaryingInfoArray VaryingInfoArray; | 108 typedef GrGLProgramDataManager::VaryingInfoArray VaryingInfoArray; |
| 103 | 109 |
| 104 GrGLProgram(GrGLGpu*, | 110 GrGLProgram(GrGLGpu*, |
| 105 const GrProgramDesc&, | 111 const GrProgramDesc&, |
| 106 const BuiltinUniformHandles&, | 112 const BuiltinUniformHandles&, |
| 107 GrGLuint programID, | 113 GrGLuint programID, |
| 108 const UniformInfoArray&, | 114 const UniformInfoArray&, |
| 109 const SkTArray<GrGLSampler>&, | 115 const SkTArray<GrGLSampler>&, |
| 110 const VaryingInfoArray&, // used for NVPR only currently | 116 const VaryingInfoArray&, // used for NVPR only currently |
| 111 GrGLSLPrimitiveProcessor* geometryProcessor, | 117 GrGLSLPrimitiveProcessor* geometryProcessor, |
| 112 GrGLSLXferProcessor* xferProcessor, | 118 GrGLSLXferProcessor* xferProcessor, |
| 113 const GrGLSLFragProcs& fragmentProcessors); | 119 const GrGLSLFragProcs& fragmentProcessors); |
| 114 | 120 |
| 115 // A helper to loop over effects, set the transforms (via subclass) and bind
textures | 121 // A helper to loop over effects, set the transforms (via subclass) and bind
textures |
| 116 void setFragmentData(const GrPrimitiveProcessor&, const GrPipeline&, int* ne
xtSamplerIdx); | 122 void setFragmentData(const GrPrimitiveProcessor&, const GrPipeline&, int* ne
xtSamplerIdx); |
| 117 void setTransformData(const GrPrimitiveProcessor&, const GrFragmentProcessor
&, int index); | 123 void setTransformData(const GrPrimitiveProcessor&, const GrFragmentProcessor
&, int index); |
| 118 | 124 |
| 119 // Helper for setData() that sets the view matrix and loads the render targe
t height uniform | 125 // Helper for setData() that sets the view matrix and loads the render targe
t height uniform |
| 120 void setRenderTargetState(const GrPrimitiveProcessor&, const GrPipeline&); | 126 void setRenderTargetState(const GrPrimitiveProcessor&, const GrPipeline&); |
| 121 | 127 |
| 122 // Helper for setData() that binds textures and texel buffers to the appropr
iate texture units | 128 // Helper for setData() that binds textures and texel buffers to the appropr
iate texture units |
| 123 void bindTextures(const GrProcessor&, bool allowSRGBInputs, int* nextSampler
Idx); | 129 void bindTextures(const GrProcessor&, bool allowSRGBInputs, int* nextSampler
Idx); |
| 124 | 130 |
| 131 // Helper for generateMipmaps() that ensures mipmaps are up to date |
| 132 void generateMipmaps(const GrProcessor&, bool allowSRGBInputs); |
| 133 |
| 125 // these reflect the current values of uniforms (GL uniform values travel wi
th program) | 134 // these reflect the current values of uniforms (GL uniform values travel wi
th program) |
| 126 RenderTargetState fRenderTargetState; | 135 RenderTargetState fRenderTargetState; |
| 127 BuiltinUniformHandles fBuiltinUniformHandles; | 136 BuiltinUniformHandles fBuiltinUniformHandles; |
| 128 GrGLuint fProgramID; | 137 GrGLuint fProgramID; |
| 129 | 138 |
| 130 // the installed effects | 139 // the installed effects |
| 131 SkAutoTDelete<GrGLSLPrimitiveProcessor> fGeometryProcessor; | 140 SkAutoTDelete<GrGLSLPrimitiveProcessor> fGeometryProcessor; |
| 132 SkAutoTDelete<GrGLSLXferProcessor> fXferProcessor; | 141 SkAutoTDelete<GrGLSLXferProcessor> fXferProcessor; |
| 133 GrGLSLFragProcs fFragmentProcessors; | 142 GrGLSLFragProcs fFragmentProcessors; |
| 134 | 143 |
| 135 GrProgramDesc fDesc; | 144 GrProgramDesc fDesc; |
| 136 GrGLGpu* fGpu; | 145 GrGLGpu* fGpu; |
| 137 GrGLProgramDataManager fProgramDataManager; | 146 GrGLProgramDataManager fProgramDataManager; |
| 138 | 147 |
| 139 friend class GrGLProgramBuilder; | 148 friend class GrGLProgramBuilder; |
| 140 | 149 |
| 141 typedef SkRefCnt INHERITED; | 150 typedef SkRefCnt INHERITED; |
| 142 }; | 151 }; |
| 143 | 152 |
| 144 #endif | 153 #endif |
| OLD | NEW |