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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 // Writes color*coverage as the primary color output and also writes cov
erage as the | 72 // Writes color*coverage as the primary color output and also writes cov
erage as the |
73 // secondary output. Only set if dual source blending is supported. | 73 // secondary output. Only set if dual source blending is supported. |
74 kSecondaryCoverage_CoverageOutput, | 74 kSecondaryCoverage_CoverageOutput, |
75 // Writes color*coverage as the primary color output and also writes cov
erage * (1 - colorA) | 75 // Writes color*coverage as the primary color output and also writes cov
erage * (1 - colorA) |
76 // as the secondary output. Only set if dual source blending is supporte
d. | 76 // as the secondary output. Only set if dual source blending is supporte
d. |
77 kSecondaryCoverageISA_CoverageOutput, | 77 kSecondaryCoverageISA_CoverageOutput, |
78 // Writes color*coverage as the primary color output and also writes cov
erage * | 78 // Writes color*coverage as the primary color output and also writes cov
erage * |
79 // (1 - colorRGB) as the secondary output. Only set if dual source blend
ing is supported. | 79 // (1 - colorRGB) as the secondary output. Only set if dual source blend
ing is supported. |
80 kSecondaryCoverageISC_CoverageOutput, | 80 kSecondaryCoverageISC_CoverageOutput, |
81 // Combines the coverage, dst, and color as coverage * color + (1 - cove
rage) * dst. This | 81 // Combines the coverage, dst, and color as coverage * color + (1 - cove
rage) * dst. This |
82 // can only be set if fDstRead is set. | 82 // can only be set if fDstReadKey is non-zero. |
83 kCombineWithDst_CoverageOutput, | 83 kCombineWithDst_CoverageOutput, |
84 | 84 |
85 kCoverageOutputCnt | 85 kCoverageOutputCnt |
86 }; | 86 }; |
87 | 87 |
88 static bool CoverageOutputUsesSecondaryOutput(CoverageOutput co) { | 88 static bool CoverageOutputUsesSecondaryOutput(CoverageOutput co) { |
89 switch (co) { | 89 switch (co) { |
90 case kSecondaryCoverage_CoverageOutput: // fallthru | 90 case kSecondaryCoverage_CoverageOutput: // fallthru |
91 case kSecondaryCoverageISA_CoverageOutput: | 91 case kSecondaryCoverageISA_CoverageOutput: |
92 case kSecondaryCoverageISC_CoverageOutput: | 92 case kSecondaryCoverageISC_CoverageOutput: |
93 return true; | 93 return true; |
94 default: | 94 default: |
95 return false; | 95 return false; |
96 } | 96 } |
97 } | 97 } |
98 | 98 |
99 /** Non-zero if this stage has an effect */ | 99 /** Non-zero if this stage has an effect */ |
100 GrGLEffect::EffectKey fEffectKeys[GrDrawState::kNumStages]; | 100 GrGLEffect::EffectKey fEffectKeys[GrDrawState::kNumStages]; |
101 | 101 |
102 // To enable experimental geometry shader code (not for use in | 102 // To enable experimental geometry shader code (not for use in |
103 // production) | 103 // production) |
104 #if GR_GL_EXPERIMENTAL_GS | 104 #if GR_GL_EXPERIMENTAL_GS |
105 bool fExperimentalGS; | 105 bool fExperimentalGS; |
106 #endif | 106 #endif |
107 | 107 |
108 GrGLShaderBuilder::DstReadKey fDstRead; // set by GrGLShaderBuil
der if there | 108 GrGLShaderBuilder::DstReadKey fDstReadKey; // set by GrGLShaderBuil
der if there |
109 // are effects that must
read the dst. | 109 // are effects that must
read the dst. |
110 // Otherwise, 0. | 110 // Otherwise, 0. |
| 111 GrGLShaderBuilder::FragPosKey fFragPosKey; // set by GrGLShaderBuil
der if there are |
| 112 // effects that read the
fragment position. |
| 113 // Otherwise, 0. |
111 | 114 |
112 // should the FS discard if the coverage is zero (to avoid stencil manipulat
ion) | 115 // should the FS discard if the coverage is zero (to avoid stencil manipulat
ion) |
113 SkBool8 fDiscardIfZeroCoverage; | 116 SkBool8 fDiscardIfZeroCoverage; |
114 | 117 |
115 uint8_t fColorInput; // casts to enum ColorIn
put | 118 uint8_t fColorInput; // casts to enum ColorIn
put |
116 uint8_t fCoverageInput; // casts to enum ColorIn
put | 119 uint8_t fCoverageInput; // casts to enum ColorIn
put |
117 uint8_t fCoverageOutput; // casts to enum Coverag
eOutput | 120 uint8_t fCoverageOutput; // casts to enum Coverag
eOutput |
118 | 121 |
119 int8_t fFirstCoverageStage; | 122 int8_t fFirstCoverageStage; |
120 SkBool8 fEmitsPointSize; | 123 SkBool8 fEmitsPointSize; |
121 uint8_t fColorFilterXfermode; // casts to enum SkXferm
ode::Mode | 124 uint8_t fColorFilterXfermode; // casts to enum SkXferm
ode::Mode |
122 | 125 |
123 int8_t fPositionAttributeIndex; | 126 int8_t fPositionAttributeIndex; |
124 int8_t fLocalCoordAttributeIndex; | 127 int8_t fLocalCoordAttributeIndex; |
125 int8_t fColorAttributeIndex; | 128 int8_t fColorAttributeIndex; |
126 int8_t fCoverageAttributeIndex; | 129 int8_t fCoverageAttributeIndex; |
127 | 130 |
128 // GrGLProgram and GrGLShaderBuilder read the private fields to generate cod
e. TODO: Move all | 131 // GrGLProgram and GrGLShaderBuilder read the private fields to generate cod
e. TODO: Move all |
129 // code generation to GrGLShaderBuilder (and maybe add getters rather than f
riending). | 132 // code generation to GrGLShaderBuilder (and maybe add getters rather than f
riending). |
130 friend class GrGLProgram; | 133 friend class GrGLProgram; |
131 friend class GrGLShaderBuilder; | 134 friend class GrGLShaderBuilder; |
132 }; | 135 }; |
133 | 136 |
134 #endif | 137 #endif |
OLD | NEW |