| 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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 } | 87 } |
| 88 } | 88 } |
| 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 SkTArray<const GrTextureAccess*>* textureBindings); | |
| 99 | 98 |
| 100 protected: | 99 protected: |
| 101 typedef GrGLSLProgramDataManager::UniformHandle UniformHandle; | 100 typedef GrGLSLProgramDataManager::UniformHandle UniformHandle; |
| 102 typedef GrGLProgramDataManager::UniformInfoArray UniformInfoArray; | 101 typedef GrGLProgramDataManager::UniformInfoArray UniformInfoArray; |
| 103 typedef GrGLProgramDataManager::VaryingInfoArray VaryingInfoArray; | 102 typedef GrGLProgramDataManager::VaryingInfoArray VaryingInfoArray; |
| 104 | 103 |
| 105 GrGLProgram(GrGLGpu*, | 104 GrGLProgram(GrGLGpu*, |
| 106 const GrProgramDesc&, | 105 const GrProgramDesc&, |
| 107 const BuiltinUniformHandles&, | 106 const BuiltinUniformHandles&, |
| 108 GrGLuint programID, | 107 GrGLuint programID, |
| 109 const UniformInfoArray&, | 108 const UniformInfoArray&, |
| 110 const VaryingInfoArray&, // used for NVPR only currently | 109 const VaryingInfoArray&, // used for NVPR only currently |
| 111 GrGLSLPrimitiveProcessor* geometryProcessor, | 110 GrGLSLPrimitiveProcessor* geometryProcessor, |
| 112 GrGLSLXferProcessor* xferProcessor, | 111 GrGLSLXferProcessor* xferProcessor, |
| 113 const GrGLSLFragProcs& fragmentProcessors, | 112 const GrGLSLFragProcs& fragmentProcessors, |
| 114 SkTArray<UniformHandle>* passSamplerUniforms); | 113 SkTArray<UniformHandle>* passSamplerUniforms); |
| 115 | 114 |
| 116 // A templated helper to loop over effects, set the transforms(via subclass)
and bind textures | 115 // A helper to loop over effects, set the transforms (via subclass) and bind
textures |
| 117 void setFragmentData(const GrPrimitiveProcessor&, const GrPipeline&, | 116 void setFragmentData(const GrPrimitiveProcessor&, const GrPipeline&, int* ne
xtSamplerIdx); |
| 118 SkTArray<const GrTextureAccess*>* textureBindings); | 117 void setTransformData(const GrPrimitiveProcessor&, const GrFragmentProcessor
&, int index); |
| 119 void setTransformData(const GrPrimitiveProcessor&, | |
| 120 const GrFragmentProcessor&, | |
| 121 int index); | |
| 122 | 118 |
| 123 // Helper for setData() that sets the view matrix and loads the render targe
t height uniform | 119 // Helper for setData() that sets the view matrix and loads the render targe
t height uniform |
| 124 void setRenderTargetState(const GrPrimitiveProcessor&, const GrPipeline&); | 120 void setRenderTargetState(const GrPrimitiveProcessor&, const GrPipeline&); |
| 125 | 121 |
| 122 // 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); |
| 124 |
| 126 // these reflect the current values of uniforms (GL uniform values travel wi
th program) | 125 // these reflect the current values of uniforms (GL uniform values travel wi
th program) |
| 127 RenderTargetState fRenderTargetState; | 126 RenderTargetState fRenderTargetState; |
| 128 BuiltinUniformHandles fBuiltinUniformHandles; | 127 BuiltinUniformHandles fBuiltinUniformHandles; |
| 129 GrGLuint fProgramID; | 128 GrGLuint fProgramID; |
| 130 | 129 |
| 131 // the installed effects | 130 // the installed effects |
| 132 SkAutoTDelete<GrGLSLPrimitiveProcessor> fGeometryProcessor; | 131 SkAutoTDelete<GrGLSLPrimitiveProcessor> fGeometryProcessor; |
| 133 SkAutoTDelete<GrGLSLXferProcessor> fXferProcessor; | 132 SkAutoTDelete<GrGLSLXferProcessor> fXferProcessor; |
| 134 GrGLSLFragProcs fFragmentProcessors; | 133 GrGLSLFragProcs fFragmentProcessors; |
| 135 | 134 |
| 136 GrProgramDesc fDesc; | 135 GrProgramDesc fDesc; |
| 137 GrGLGpu* fGpu; | 136 GrGLGpu* fGpu; |
| 138 GrGLProgramDataManager fProgramDataManager; | 137 GrGLProgramDataManager fProgramDataManager; |
| 139 SkTArray<UniformHandle> fSamplerUniforms; | 138 SkTArray<UniformHandle> fSamplerUniforms; |
| 140 | 139 |
| 141 friend class GrGLProgramBuilder; | 140 friend class GrGLProgramBuilder; |
| 142 | 141 |
| 143 typedef SkRefCnt INHERITED; | 142 typedef SkRefCnt INHERITED; |
| 144 }; | 143 }; |
| 145 | 144 |
| 146 #endif | 145 #endif |
| OLD | NEW |