Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(96)

Side by Side Diff: src/gpu/gl/GrGLProgram.h

Issue 13314002: Add support for reading the dst pixel value in an effect. Use in a new effect for the kDarken xfer … (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Revert whitespace/comment changes accidentally made in GrGLProgramDesc.cpp Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/gpu/SkGpuDevice.cpp ('k') | src/gpu/gl/GrGLProgram.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 } 95 }
96 }; 96 };
97 97
98 /** 98 /**
99 * This function uploads uniforms and calls each GrGLEffect's setData. It is called before a 99 * This function uploads uniforms and calls each GrGLEffect's setData. It is called before a
100 * draw occurs using the program after the program has already been bound. I t also uses the 100 * draw occurs using the program after the program has already been bound. I t also uses the
101 * GrGpuGL object to bind the textures required by the GrGLEffects. 101 * GrGpuGL object to bind the textures required by the GrGLEffects.
102 * 102 *
103 * The color and coverage params override the GrDrawState's getColor() and g etCoverage() values. 103 * The color and coverage params override the GrDrawState's getColor() and g etCoverage() values.
104 */ 104 */
105 void setData(GrGpuGL*, GrColor color, GrColor coverage, SharedGLState*); 105 void setData(GrGpuGL*,
106 GrColor color,
107 GrColor coverage,
108 const GrDeviceCoordTexture* dstCopy, // can be NULL
109 SharedGLState*);
106 110
107 private: 111 private:
108 GrGLProgram(const GrGLContext& gl, 112 GrGLProgram(const GrGLContext& gl,
109 const GrGLProgramDesc& desc, 113 const GrGLProgramDesc& desc,
110 const GrEffectStage* stages[]); 114 const GrEffectStage* stages[]);
111 115
112 bool succeeded() const { return 0 != fProgramID; } 116 bool succeeded() const { return 0 != fProgramID; }
113 117
114 /** 118 /**
115 * This is the heavy initialization routine for building a GLProgram. 119 * This is the heavy initialization routine for building a GLProgram.
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 // Helper for setData() that sets the view matrix and loads the render targe t height uniform 151 // Helper for setData() that sets the view matrix and loads the render targe t height uniform
148 void setMatrixAndRenderTargetHeight(const GrDrawState&); 152 void setMatrixAndRenderTargetHeight(const GrDrawState&);
149 153
150 typedef SkSTArray<4, UniformHandle, true> SamplerUniSArray; 154 typedef SkSTArray<4, UniformHandle, true> SamplerUniSArray;
151 155
152 struct UniformHandles { 156 struct UniformHandles {
153 UniformHandle fViewMatrixUni; 157 UniformHandle fViewMatrixUni;
154 UniformHandle fColorUni; 158 UniformHandle fColorUni;
155 UniformHandle fCoverageUni; 159 UniformHandle fCoverageUni;
156 UniformHandle fColorFilterUni; 160 UniformHandle fColorFilterUni;
161
157 // We use the render target height to provide a y-down frag coord when s pecifying 162 // We use the render target height to provide a y-down frag coord when s pecifying
158 // origin_upper_left is not supported. 163 // origin_upper_left is not supported.
159 UniformHandle fRTHeightUni; 164 UniformHandle fRTHeightUni;
165
166 // Uniforms for computing texture coords to do the dst-copy lookup
167 UniformHandle fDstCopyTopLeftUni;
168 UniformHandle fDstCopyScaleUni;
169 UniformHandle fDstCopySamplerUni;
170
160 // An array of sampler uniform handles for each effect. 171 // An array of sampler uniform handles for each effect.
161 SamplerUniSArray fSamplerUnis[GrDrawState::kNumStages]; 172 SamplerUniSArray fEffectSamplerUnis[GrDrawState::kNumStages];
162 173
163 UniformHandles() { 174 UniformHandles() {
164 fViewMatrixUni = GrGLUniformManager::kInvalidUniformHandle; 175 fViewMatrixUni = GrGLUniformManager::kInvalidUniformHandle;
165 fColorUni = GrGLUniformManager::kInvalidUniformHandle; 176 fColorUni = GrGLUniformManager::kInvalidUniformHandle;
166 fCoverageUni = GrGLUniformManager::kInvalidUniformHandle; 177 fCoverageUni = GrGLUniformManager::kInvalidUniformHandle;
167 fColorFilterUni = GrGLUniformManager::kInvalidUniformHandle; 178 fColorFilterUni = GrGLUniformManager::kInvalidUniformHandle;
168 fRTHeightUni = GrGLUniformManager::kInvalidUniformHandle; 179 fRTHeightUni = GrGLUniformManager::kInvalidUniformHandle;
180 fDstCopyTopLeftUni = GrGLUniformManager::kInvalidUniformHandle;
181 fDstCopyScaleUni = GrGLUniformManager::kInvalidUniformHandle;
182 fDstCopySamplerUni = GrGLUniformManager::kInvalidUniformHandle;
169 } 183 }
170 }; 184 };
171 185
172 // GL IDs 186 // GL IDs
173 GrGLuint fVShaderID; 187 GrGLuint fVShaderID;
174 GrGLuint fGShaderID; 188 GrGLuint fGShaderID;
175 GrGLuint fFShaderID; 189 GrGLuint fFShaderID;
176 GrGLuint fProgramID; 190 GrGLuint fProgramID;
177 191
178 // these reflect the current values of uniforms (GL uniform values travel wi th program) 192 // these reflect the current values of uniforms (GL uniform values travel wi th program)
179 MatrixState fMatrixState; 193 MatrixState fMatrixState;
180 GrColor fColor; 194 GrColor fColor;
181 GrColor fCoverage; 195 GrColor fCoverage;
182 GrColor fColorFilterColor; 196 GrColor fColorFilterColor;
183 197
184 GrGLEffect* fEffects[GrDrawState::kNumStages]; 198 GrGLEffect* fEffects[GrDrawState::kNumStages];
185 199
186 GrGLProgramDesc fDesc; 200 GrGLProgramDesc fDesc;
187 const GrGLContext& fContext; 201 const GrGLContext& fContext;
188 202
189 GrGLUniformManager fUniformManager; 203 GrGLUniformManager fUniformManager;
190 UniformHandles fUniformHandles; 204 UniformHandles fUniformHandles;
191 205
192 typedef GrRefCnt INHERITED; 206 typedef GrRefCnt INHERITED;
193 }; 207 };
194 208
195 #endif 209 #endif
OLDNEW
« no previous file with comments | « src/gpu/SkGpuDevice.cpp ('k') | src/gpu/gl/GrGLProgram.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698