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 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
410 | 410 |
411 bool addEffectAttribute(int attributeIndex, GrSLType type, const SkString& n
ame); | 411 bool addEffectAttribute(int attributeIndex, GrSLType type, const SkString& n
ame); |
412 const SkString* getEffectAttributeName(int attributeIndex) const; | 412 const SkString* getEffectAttributeName(int attributeIndex) const; |
413 | 413 |
414 virtual GrGLProgramEffects* createAndEmitEffects( | 414 virtual GrGLProgramEffects* createAndEmitEffects( |
415 const GrEffectStage* effectStages[], | 415 const GrEffectStage* effectStages[], |
416 const EffectKey effectKeys[], | 416 const EffectKey effectKeys[], |
417 int effectCnt, | 417 int effectCnt, |
418 GrGLSLExpr4* inOutFSColor) SK_OVERRIDE; | 418 GrGLSLExpr4* inOutFSColor) SK_OVERRIDE; |
419 | 419 |
| 420 /** |
| 421 * The view matrix uniform is only valid in the VS. It is always mat33. |
| 422 */ |
420 GrGLUniformManager::UniformHandle getViewMatrixUniform() const { | 423 GrGLUniformManager::UniformHandle getViewMatrixUniform() const { |
421 return fViewMatrixUniform; | 424 return fViewMatrixUniform; |
422 } | 425 } |
423 | 426 |
| 427 GrGLUniformManager::UniformHandle getRTAdjustmentVecUniform() const { |
| 428 return fRTAdustmentVecUniform; |
| 429 } |
| 430 |
424 protected: | 431 protected: |
425 virtual bool compileAndAttachShaders(GrGLuint programId, SkTDArray<GrGLuint>
* shaderIds) const SK_OVERRIDE; | 432 virtual bool compileAndAttachShaders(GrGLuint programId, SkTDArray<GrGLuint>
* shaderIds) const SK_OVERRIDE; |
426 virtual void bindProgramLocations(GrGLuint programId) const SK_OVERRIDE; | 433 virtual void bindProgramLocations(GrGLuint programId) const SK_OVERRIDE; |
427 | 434 |
428 private: | 435 private: |
429 const GrGLProgramDesc& fDesc; | 436 const GrGLProgramDesc& fDesc; |
430 VarArray fVSAttrs; | 437 VarArray fVSAttrs; |
431 VarArray fVSOutputs; | 438 VarArray fVSOutputs; |
432 VarArray fGSInputs; | 439 VarArray fGSInputs; |
433 VarArray fGSOutputs; | 440 VarArray fGSOutputs; |
434 | 441 |
435 SkString fVSCode; | 442 SkString fVSCode; |
436 | 443 |
437 struct AttributePair { | 444 struct AttributePair { |
438 void set(int index, const SkString& name) { | 445 void set(int index, const SkString& name) { |
439 fIndex = index; fName = name; | 446 fIndex = index; fName = name; |
440 } | 447 } |
441 int fIndex; | 448 int fIndex; |
442 SkString fName; | 449 SkString fName; |
443 }; | 450 }; |
444 SkSTArray<10, AttributePair, true> fEffectAttributes; | 451 SkSTArray<10, AttributePair, true> fEffectAttributes; |
445 | 452 |
446 GrGLUniformManager::UniformHandle fViewMatrixUniform; | 453 GrGLUniformManager::UniformHandle fViewMatrixUniform; |
447 | 454 GrGLUniformManager::UniformHandle fRTAdustmentVecUniform; |
448 GrGLShaderVar* fPositionVar; | 455 GrGLShaderVar* fPositionVar; |
449 GrGLShaderVar* fLocalCoordsVar; | 456 GrGLShaderVar* fLocalCoordsVar; |
450 | 457 |
451 typedef GrGLShaderBuilder INHERITED; | 458 typedef GrGLShaderBuilder INHERITED; |
452 }; | 459 }; |
453 | 460 |
454 //////////////////////////////////////////////////////////////////////////////// | 461 //////////////////////////////////////////////////////////////////////////////// |
455 | 462 |
456 class GrGLFragmentOnlyShaderBuilder : public GrGLShaderBuilder { | 463 class GrGLFragmentOnlyShaderBuilder : public GrGLShaderBuilder { |
457 public: | 464 public: |
458 GrGLFragmentOnlyShaderBuilder(GrGpuGL*, GrGLUniformManager&, const GrGLProgr
amDesc&); | 465 GrGLFragmentOnlyShaderBuilder(GrGpuGL*, GrGLUniformManager&, const GrGLProgr
amDesc&); |
459 | 466 |
460 int getNumTexCoordSets() const { return fNumTexCoordSets; } | 467 int getNumTexCoordSets() const { return fNumTexCoordSets; } |
461 int addTexCoordSets(int count); | 468 int addTexCoordSets(int count); |
462 | 469 |
463 virtual GrGLProgramEffects* createAndEmitEffects( | 470 virtual GrGLProgramEffects* createAndEmitEffects( |
464 const GrEffectStage* effectStages[], | 471 const GrEffectStage* effectStages[], |
465 const EffectKey effectKeys[], | 472 const EffectKey effectKeys[], |
466 int effectCnt, | 473 int effectCnt, |
467 GrGLSLExpr4* inOutFSColor) SK_OVERRIDE; | 474 GrGLSLExpr4* inOutFSColor) SK_OVERRIDE; |
468 | 475 |
469 private: | 476 private: |
470 int fNumTexCoordSets; | 477 int fNumTexCoordSets; |
471 | 478 |
472 typedef GrGLShaderBuilder INHERITED; | 479 typedef GrGLShaderBuilder INHERITED; |
473 }; | 480 }; |
474 | 481 |
475 #endif | 482 #endif |
OLD | NEW |