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&, bool allowSRGBI nputs); |
bsalomon
2016/04/11 16:51:38
Is this bool not just gettable from the GrPipeline
Chris Dalton
2016/04/11 19:48:19
Done.
| |
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&, |
118 SkTArray<const GrTextureAccess*>* textureBindings); | 117 bool allowSRGBInputs, int* nextSamplerIdx); |
119 void setTransformData(const GrPrimitiveProcessor&, | 118 void setTransformData(const GrPrimitiveProcessor&, |
120 const GrFragmentProcessor&, | 119 const GrFragmentProcessor&, |
121 int index); | 120 int index); |
122 | 121 |
123 // Helper for setData() that sets the view matrix and loads the render targe t height uniform | 122 // Helper for setData() that sets the view matrix and loads the render targe t height uniform |
124 void setRenderTargetState(const GrPrimitiveProcessor&, const GrPipeline&); | 123 void setRenderTargetState(const GrPrimitiveProcessor&, const GrPipeline&); |
125 | 124 |
125 // Helper for setData() that binds textures and texel buffers to the appropr iate texture units | |
126 void bindTextures(const GrProcessor&, bool allowSRGBInputs, int* nextSampler Idx); | |
127 | |
126 // these reflect the current values of uniforms (GL uniform values travel wi th program) | 128 // these reflect the current values of uniforms (GL uniform values travel wi th program) |
127 RenderTargetState fRenderTargetState; | 129 RenderTargetState fRenderTargetState; |
128 BuiltinUniformHandles fBuiltinUniformHandles; | 130 BuiltinUniformHandles fBuiltinUniformHandles; |
129 GrGLuint fProgramID; | 131 GrGLuint fProgramID; |
130 | 132 |
131 // the installed effects | 133 // the installed effects |
132 SkAutoTDelete<GrGLSLPrimitiveProcessor> fGeometryProcessor; | 134 SkAutoTDelete<GrGLSLPrimitiveProcessor> fGeometryProcessor; |
133 SkAutoTDelete<GrGLSLXferProcessor> fXferProcessor; | 135 SkAutoTDelete<GrGLSLXferProcessor> fXferProcessor; |
134 GrGLSLFragProcs fFragmentProcessors; | 136 GrGLSLFragProcs fFragmentProcessors; |
135 | 137 |
136 GrProgramDesc fDesc; | 138 GrProgramDesc fDesc; |
137 GrGLGpu* fGpu; | 139 GrGLGpu* fGpu; |
138 GrGLProgramDataManager fProgramDataManager; | 140 GrGLProgramDataManager fProgramDataManager; |
139 SkTArray<UniformHandle> fSamplerUniforms; | 141 SkTArray<UniformHandle> fSamplerUniforms; |
140 | 142 |
141 friend class GrGLProgramBuilder; | 143 friend class GrGLProgramBuilder; |
142 | 144 |
143 typedef SkRefCnt INHERITED; | 145 typedef SkRefCnt INHERITED; |
144 }; | 146 }; |
145 | 147 |
146 #endif | 148 #endif |
OLD | NEW |