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

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

Issue 12462008: Add GrEllipseEdgeEffect (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: rebase again Created 7 years, 9 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/gl/GrGLSL.h ('k') | src/gpu/gl/GrGLShaderBuilder.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 2012 Google Inc. 2 * Copyright 2012 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 GrGLShaderBuilder_DEFINED 8 #ifndef GrGLShaderBuilder_DEFINED
9 #define GrGLShaderBuilder_DEFINED 9 #define GrGLShaderBuilder_DEFINED
10 10
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 177
178 const GrGLShaderVar& getUniformVariable(GrGLUniformManager::UniformHandle) c onst; 178 const GrGLShaderVar& getUniformVariable(GrGLUniformManager::UniformHandle) c onst;
179 179
180 /** 180 /**
181 * Shortcut for getUniformVariable(u).c_str() 181 * Shortcut for getUniformVariable(u).c_str()
182 */ 182 */
183 const char* getUniformCStr(GrGLUniformManager::UniformHandle u) const { 183 const char* getUniformCStr(GrGLUniformManager::UniformHandle u) const {
184 return this->getUniformVariable(u).c_str(); 184 return this->getUniformVariable(u).c_str();
185 } 185 }
186 186
187 /** Add a varying variable to the current program to pass values between ver tex and fragment 187 /** Add a vertex attribute to the current program that is passed in from the vertex data.
188 Returns false if the attribute was already there, true otherwise. */
189 bool addAttribute(GrSLType type, const char* name);
190
191 /** Add a varying variable to the current program to pass values between vert ex and fragment
188 shaders. If the last two parameters are non-NULL, they are filled in wit h the name 192 shaders. If the last two parameters are non-NULL, they are filled in wit h the name
189 generated. */ 193 generated. */
190 void addVarying(GrSLType type, 194 void addVarying(GrSLType type,
191 const char* name, 195 const char* name,
192 const char** vsOutName = NULL, 196 const char** vsOutName = NULL,
193 const char** fsInName = NULL); 197 const char** fsInName = NULL);
194 198
195 /** Returns a variable name that represents the position of the fragment in the FS. The position 199 /** Returns a variable name that represents the position of the fragment in the FS. The position
196 is in device space (e.g. 0,0 is the top left and pixel centers are at ha lf-integers). */ 200 is in device space (e.g. 0,0 is the top left and pixel centers are at ha lf-integers). */
197 const char* fragmentPosition(); 201 const char* fragmentPosition();
(...skipping 17 matching lines...) Expand all
215 // TODO: move remainder of shader code generation to this class and call thi s privately 219 // TODO: move remainder of shader code generation to this class and call thi s privately
216 // Handles of sampler uniforms generated for the effect are appended to samp lerHandles. 220 // Handles of sampler uniforms generated for the effect are appended to samp lerHandles.
217 GrGLEffect* createAndEmitGLEffect( 221 GrGLEffect* createAndEmitGLEffect(
218 const GrEffectStage& stage, 222 const GrEffectStage& stage,
219 GrBackendEffectFactory::EffectKey key, 223 GrBackendEffectFactory::EffectKey key,
220 const char* fsInColor, // NULL means no incoming color 224 const char* fsInColor, // NULL means no incoming color
221 const char* fsOutColor, 225 const char* fsOutColor,
222 const char* vsInCoord, 226 const char* vsInCoord,
223 SkTArray<GrGLUniformManager::UniformHandle, true >* samplerHandles); 227 SkTArray<GrGLUniformManager::UniformHandle, true >* samplerHandles);
224 GrGLUniformManager::UniformHandle getRTHeightUniform() const { return fRTHei ghtUniform; } 228 GrGLUniformManager::UniformHandle getRTHeightUniform() const { return fRTHei ghtUniform; }
229
230 struct AttributePair {
231 void set(int index, const SkString& name) {
232 fIndex = index; fName = name;
233 }
234 int fIndex;
235 SkString fName;
236 };
237 const SkSTArray<10, AttributePair, true>& getEffectAttributes() const {
238 return fEffectAttributes;
239 }
240 const SkString* getEffectAttributeName(int attributeIndex) const;
241
225 // TODO: Make this do all the compiling, linking, etc. 242 // TODO: Make this do all the compiling, linking, etc.
226 void finished(GrGLuint programID); 243 void finished(GrGLuint programID);
227 244
228 const GrGLContextInfo& ctxInfo() const { return fCtxInfo; } 245 const GrGLContextInfo& ctxInfo() const { return fCtxInfo; }
229 246
230 private: 247 private:
231 void codeAppendf(ShaderType type, const char format[], va_list args); 248 void codeAppendf(ShaderType type, const char format[], va_list args);
232 void codeAppend(ShaderType type, const char* str); 249 void codeAppend(ShaderType type, const char* str);
233 250
234 typedef GrTAllocator<GrGLShaderVar> VarArray; 251 typedef GrTAllocator<GrGLShaderVar> VarArray;
(...skipping 28 matching lines...) Expand all
263 SkString fFSFunctions; 280 SkString fFSFunctions;
264 SkString fFSHeader; 281 SkString fFSHeader;
265 282
266 SkString fFSCode; 283 SkString fFSCode;
267 SkString fVSCode; 284 SkString fVSCode;
268 SkString fGSCode; 285 SkString fGSCode;
269 286
270 bool fSetupFragPosition; 287 bool fSetupFragPosition;
271 GrGLUniformManager::UniformHandle fRTHeightUniform; 288 GrGLUniformManager::UniformHandle fRTHeightUniform;
272 289
290 SkSTArray<10, AttributePair, true> fEffectAttributes;
291
273 GrGLShaderVar* fPositionVar; 292 GrGLShaderVar* fPositionVar;
274 }; 293 };
275 294
276 #endif 295 #endif
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGLSL.h ('k') | src/gpu/gl/GrGLShaderBuilder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698