| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 GrGLProgramDesc_DEFINED | 8 #ifndef GrGLProgramDesc_DEFINED |
| 9 #define GrGLProgramDesc_DEFINED | 9 #define GrGLProgramDesc_DEFINED |
| 10 | 10 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 | 32 |
| 33 // Returns this as a uint32_t array to be used as a key in the program cache | 33 // Returns this as a uint32_t array to be used as a key in the program cache |
| 34 const uint32_t* asKey() const { | 34 const uint32_t* asKey() const { |
| 35 return reinterpret_cast<const uint32_t*>(this); | 35 return reinterpret_cast<const uint32_t*>(this); |
| 36 } | 36 } |
| 37 | 37 |
| 38 // For unit testing. | 38 // For unit testing. |
| 39 void setRandom(SkMWCRandom*, | 39 void setRandom(SkMWCRandom*, |
| 40 const GrGpuGL* gpu, | 40 const GrGpuGL* gpu, |
| 41 const GrTexture* dummyDstTexture, | 41 const GrTexture* dummyDstTexture, |
| 42 const GrEffectStage stages[GrDrawState::kNumStages]); | 42 const GrEffectStage stages[GrDrawState::kNumStages], |
| 43 int currAttribIndex); |
| 43 | 44 |
| 44 /** | 45 /** |
| 45 * Builds a program descriptor from a GrDrawState. Whether the primitive typ
e is points, the | 46 * Builds a program descriptor from a GrDrawState. Whether the primitive typ
e is points, the |
| 46 * output of GrDrawState::getBlendOpts, and the caps of the GrGpuGL are also
inputs. | 47 * output of GrDrawState::getBlendOpts, and the caps of the GrGpuGL are also
inputs. |
| 47 */ | 48 */ |
| 48 static void Build(const GrDrawState&, | 49 static void Build(const GrDrawState&, |
| 49 bool isPoints, | 50 bool isPoints, |
| 50 GrDrawState::BlendOptFlags, | 51 GrDrawState::BlendOptFlags, |
| 51 GrBlendCoeff srcCoeff, | 52 GrBlendCoeff srcCoeff, |
| 52 GrBlendCoeff dstCoeff, | 53 GrBlendCoeff dstCoeff, |
| (...skipping 16 matching lines...) Expand all Loading... |
| 69 // secondary source is output and what value it holds. | 70 // secondary source is output and what value it holds. |
| 70 enum DualSrcOutput { | 71 enum DualSrcOutput { |
| 71 kNone_DualSrcOutput, | 72 kNone_DualSrcOutput, |
| 72 kCoverage_DualSrcOutput, | 73 kCoverage_DualSrcOutput, |
| 73 kCoverageISA_DualSrcOutput, | 74 kCoverageISA_DualSrcOutput, |
| 74 kCoverageISC_DualSrcOutput, | 75 kCoverageISC_DualSrcOutput, |
| 75 | 76 |
| 76 kDualSrcOutputCnt | 77 kDualSrcOutputCnt |
| 77 }; | 78 }; |
| 78 | 79 |
| 79 // should the FS discard if the coverage is zero (to avoid stencil manipulat
ion) | |
| 80 bool fDiscardIfZeroCoverage; | |
| 81 | |
| 82 // stripped of bits that don't affect program generation | |
| 83 GrAttribBindings fAttribBindings; | |
| 84 | |
| 85 /** Non-zero if this stage has an effect */ | 80 /** Non-zero if this stage has an effect */ |
| 86 GrGLEffect::EffectKey fEffectKeys[GrDrawState::kNumStages]; | 81 GrGLEffect::EffectKey fEffectKeys[GrDrawState::kNumStages]; |
| 87 | 82 |
| 88 // To enable experimental geometry shader code (not for use in | 83 // To enable experimental geometry shader code (not for use in» |
| 89 // production) | 84 // production)» |
| 90 #if GR_GL_EXPERIMENTAL_GS | 85 #if GR_GL_EXPERIMENTAL_GS» |
| 91 bool fExperimentalGS; | 86 bool fExperimentalGS;» |
| 92 #endif | 87 #endif» |
| 88 |
| 93 GrGLShaderBuilder::DstReadKey fDstRead; // set by GrGLShaderBuil
der if there | 89 GrGLShaderBuilder::DstReadKey fDstRead; // set by GrGLShaderBuil
der if there |
| 94 // are effects that must
read the dst. | 90 // are effects that must
read the dst. |
| 95 // Otherwise, 0. | 91 // Otherwise, 0. |
| 96 | 92 |
| 93 // should the FS discard if the coverage is zero (to avoid stencil manipulat
ion) |
| 94 SkBool8 fDiscardIfZeroCoverage; |
| 95 |
| 97 uint8_t fColorInput; // casts to enum ColorIn
put | 96 uint8_t fColorInput; // casts to enum ColorIn
put |
| 98 uint8_t fCoverageInput; // casts to enum ColorIn
put | 97 uint8_t fCoverageInput; // casts to enum ColorIn
put |
| 99 uint8_t fDualSrcOutput; // casts to enum DualSrc
Output | 98 uint8_t fDualSrcOutput; // casts to enum DualSrc
Output |
| 99 |
| 100 int8_t fFirstCoverageStage; | 100 int8_t fFirstCoverageStage; |
| 101 SkBool8 fEmitsPointSize; | 101 SkBool8 fEmitsPointSize; |
| 102 uint8_t fColorFilterXfermode; // casts to enum SkXferm
ode::Mode | 102 uint8_t fColorFilterXfermode; // casts to enum SkXferm
ode::Mode |
| 103 | 103 |
| 104 int8_t fPositionAttributeIndex; | 104 int8_t fPositionAttributeIndex; |
| 105 int8_t fLocalCoordAttributeIndex; |
| 105 int8_t fColorAttributeIndex; | 106 int8_t fColorAttributeIndex; |
| 106 int8_t fCoverageAttributeIndex; | 107 int8_t fCoverageAttributeIndex; |
| 107 int8_t fLocalCoordsAttributeIndex; | |
| 108 | 108 |
| 109 // GrGLProgram and GrGLShaderBuilder read the private fields to generate cod
e. TODO: Move all | 109 // GrGLProgram and GrGLShaderBuilder read the private fields to generate cod
e. TODO: Move all |
| 110 // code generation to GrGLShaderBuilder (and maybe add getters rather than f
riending). | 110 // code generation to GrGLShaderBuilder (and maybe add getters rather than f
riending). |
| 111 friend class GrGLProgram; | 111 friend class GrGLProgram; |
| 112 friend class GrGLShaderBuilder; | 112 friend class GrGLShaderBuilder; |
| 113 }; | 113 }; |
| 114 | 114 |
| 115 #endif | 115 #endif |
| OLD | NEW |