OLD | NEW |
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 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 GrGLUniformManager::UniformHandle getColorUniform() const { return fColorUni
form; } | 201 GrGLUniformManager::UniformHandle getColorUniform() const { return fColorUni
form; } |
202 GrGLUniformManager::UniformHandle getCoverageUniform() const { return fCover
ageUniform; } | 202 GrGLUniformManager::UniformHandle getCoverageUniform() const { return fCover
ageUniform; } |
203 GrGLUniformManager::UniformHandle getDstCopySamplerUniform() const { | 203 GrGLUniformManager::UniformHandle getDstCopySamplerUniform() const { |
204 return fDstCopySamplerUniform; | 204 return fDstCopySamplerUniform; |
205 } | 205 } |
206 | 206 |
207 bool finish(GrGLuint* outProgramId); | 207 bool finish(GrGLuint* outProgramId); |
208 | 208 |
209 const GrGLContextInfo& ctxInfo() const; | 209 const GrGLContextInfo& ctxInfo() const; |
210 | 210 |
| 211 /** |
| 212 * Helper for begining and ending a block in the fragment code. TODO: Make G
rGLShaderBuilder |
| 213 * aware of all blocks and turn single \t's into the correct number of tabs
(or spaces) so that |
| 214 * our shaders print pretty without effect writers tracking indentation. |
| 215 */ |
| 216 class FSBlock { |
| 217 public: |
| 218 FSBlock(GrGLShaderBuilder* builder) : fBuilder(builder) { |
| 219 SkASSERT(NULL != builder); |
| 220 fBuilder->fsCodeAppend("\t{\n"); |
| 221 } |
| 222 |
| 223 ~FSBlock() { |
| 224 fBuilder->fsCodeAppend("\t}\n"); |
| 225 } |
| 226 private: |
| 227 GrGLShaderBuilder* fBuilder; |
| 228 }; |
| 229 |
211 protected: | 230 protected: |
212 GrGpuGL* gpu() const { return fGpu; } | 231 GrGpuGL* gpu() const { return fGpu; } |
213 | 232 |
214 void setInputColor(const GrGLSLExpr4& inputColor) { fInputColor = inputColor
; } | 233 void setInputColor(const GrGLSLExpr4& inputColor) { fInputColor = inputColor
; } |
215 void setInputCoverage(const GrGLSLExpr4& inputCoverage) { fInputCoverage = i
nputCoverage; } | 234 void setInputCoverage(const GrGLSLExpr4& inputCoverage) { fInputCoverage = i
nputCoverage; } |
216 | 235 |
217 /** Add input/output variable declarations (i.e. 'varying') to the fragment
shader. */ | 236 /** Add input/output variable declarations (i.e. 'varying') to the fragment
shader. */ |
218 GrGLShaderVar& fsInputAppend() { return fFSInputs.push_back(); } | 237 GrGLShaderVar& fsInputAppend() { return fFSInputs.push_back(); } |
219 | 238 |
220 // Generates a name for a variable. The generated string will be name prefix
ed by the prefix | 239 // Generates a name for a variable. The generated string will be name prefix
ed by the prefix |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
447 int effectCnt, | 466 int effectCnt, |
448 GrGLSLExpr4* inOutFSColor) SK_OVERRIDE; | 467 GrGLSLExpr4* inOutFSColor) SK_OVERRIDE; |
449 | 468 |
450 private: | 469 private: |
451 int fNumTexCoordSets; | 470 int fNumTexCoordSets; |
452 | 471 |
453 typedef GrGLShaderBuilder INHERITED; | 472 typedef GrGLShaderBuilder INHERITED; |
454 }; | 473 }; |
455 | 474 |
456 #endif | 475 #endif |
OLD | NEW |