| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 GrGLProgramBuilder_DEFINED | 8 #ifndef GrGLProgramBuilder_DEFINED |
| 9 #define GrGLProgramBuilder_DEFINED | 9 #define GrGLProgramBuilder_DEFINED |
| 10 | 10 |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 class GrGLProgramBuilder : public GrGLGPBuilder, | 179 class GrGLProgramBuilder : public GrGLGPBuilder, |
| 180 public GrGLFPBuilder { | 180 public GrGLFPBuilder { |
| 181 public: | 181 public: |
| 182 /** Generates a shader program. | 182 /** Generates a shader program. |
| 183 * | 183 * |
| 184 * The program implements what is specified in the stages given as input. | 184 * The program implements what is specified in the stages given as input. |
| 185 * After successful generation, the builder result objects are available | 185 * After successful generation, the builder result objects are available |
| 186 * to be used. | 186 * to be used. |
| 187 * @return true if generation was successful. | 187 * @return true if generation was successful. |
| 188 */ | 188 */ |
| 189 static GrGLProgram* CreateProgram(const GrOptDrawState&, GrGpu::DrawType, Gr
GpuGL*); | 189 static GrGLProgram* CreateProgram(const GrOptDrawState&, |
| 190 const GrProgramDesc&, |
| 191 GrGpu::DrawType, |
| 192 GrGpuGL*); |
| 190 | 193 |
| 191 virtual UniformHandle addUniform(uint32_t visibility, | 194 virtual UniformHandle addUniform(uint32_t visibility, |
| 192 GrSLType type, | 195 GrSLType type, |
| 193 const char* name, | 196 const char* name, |
| 194 const char** outName = NULL) SK_OVERRIDE { | 197 const char** outName = NULL) SK_OVERRIDE { |
| 195 return this->addUniformArray(visibility, type, name, GrGLShaderVar::kNon
Array, outName); | 198 return this->addUniformArray(visibility, type, name, GrGLShaderVar::kNon
Array, outName); |
| 196 } | 199 } |
| 197 virtual UniformHandle addUniformArray(uint32_t visibility, | 200 virtual UniformHandle addUniformArray(uint32_t visibility, |
| 198 GrSLType type, | 201 GrSLType type, |
| 199 const char* name, | 202 const char* name, |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 UniformHandle fDstCopyTopLeftUni; | 242 UniformHandle fDstCopyTopLeftUni; |
| 240 UniformHandle fDstCopyScaleUni; | 243 UniformHandle fDstCopyScaleUni; |
| 241 UniformHandle fDstCopySamplerUni; | 244 UniformHandle fDstCopySamplerUni; |
| 242 }; | 245 }; |
| 243 | 246 |
| 244 protected: | 247 protected: |
| 245 typedef GrGLProgramDataManager::UniformInfo UniformInfo; | 248 typedef GrGLProgramDataManager::UniformInfo UniformInfo; |
| 246 typedef GrGLProgramDataManager::UniformInfoArray UniformInfoArray; | 249 typedef GrGLProgramDataManager::UniformInfoArray UniformInfoArray; |
| 247 | 250 |
| 248 static GrGLProgramBuilder* CreateProgramBuilder(const GrOptDrawState&, | 251 static GrGLProgramBuilder* CreateProgramBuilder(const GrOptDrawState&, |
| 252 const GrProgramDesc&, |
| 249 GrGpu::DrawType, | 253 GrGpu::DrawType, |
| 250 bool hasGeometryProcessor, | 254 bool hasGeometryProcessor, |
| 251 GrGpuGL*); | 255 GrGpuGL*); |
| 252 | 256 |
| 253 GrGLProgramBuilder(GrGpuGL*, const GrOptDrawState&); | 257 GrGLProgramBuilder(GrGpuGL*, const GrOptDrawState&, const GrProgramDesc&); |
| 254 | 258 |
| 255 const GrOptDrawState& optState() const { return fOptState; } | 259 const GrOptDrawState& optState() const { return fOptState; } |
| 256 const GrProgramDesc& desc() const { return fDesc; } | 260 const GrProgramDesc& desc() const { return fDesc; } |
| 257 const GrProgramDesc::KeyHeader& header() const { return fDesc.header(); } | 261 const GrProgramDesc::KeyHeader& header() const { return fDesc.header(); } |
| 258 | 262 |
| 259 // Generates a name for a variable. The generated string will be name prefix
ed by the prefix | 263 // Generates a name for a variable. The generated string will be name prefix
ed by the prefix |
| 260 // char (unless the prefix is '\0'). It also mangles the name to be stage-sp
ecific if we're | 264 // char (unless the prefix is '\0'). It also mangles the name to be stage-sp
ecific if we're |
| 261 // generating stage code. | 265 // generating stage code. |
| 262 void nameVariable(SkString* out, char prefix, const char* name); | 266 void nameVariable(SkString* out, char prefix, const char* name); |
| 263 void setupUniformColorAndCoverageIfNeeded(GrGLSLExpr4* inputColor, GrGLSLExp
r1* inputCoverage); | 267 void setupUniformColorAndCoverageIfNeeded(GrGLSLExpr4* inputColor, GrGLSLExp
r1* inputCoverage); |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 424 SkAutoTDelete<GrGLFragmentProcessor> fGLProc; | 428 SkAutoTDelete<GrGLFragmentProcessor> fGLProc; |
| 425 SkSTArray<2, Transform, true> fTransforms; | 429 SkSTArray<2, Transform, true> fTransforms; |
| 426 }; | 430 }; |
| 427 | 431 |
| 428 struct GrGLInstalledFragProcs : public SkRefCnt { | 432 struct GrGLInstalledFragProcs : public SkRefCnt { |
| 429 virtual ~GrGLInstalledFragProcs(); | 433 virtual ~GrGLInstalledFragProcs(); |
| 430 SkSTArray<8, GrGLInstalledFragProc*, true> fProcs; | 434 SkSTArray<8, GrGLInstalledFragProc*, true> fProcs; |
| 431 }; | 435 }; |
| 432 | 436 |
| 433 #endif | 437 #endif |
| OLD | NEW |