OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 #include "GrGLProgram.h" | 8 #include "GrGLProgram.h" |
9 | 9 |
10 #include "GrAllocator.h" | 10 #include "GrAllocator.h" |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 case GrGLProgramDesc::kUniform_ColorInput: | 171 case GrGLProgramDesc::kUniform_ColorInput: |
172 if (fColor != color && fBuilderOutput.fUniformHandles.fColorUni.
isValid()) { | 172 if (fColor != color && fBuilderOutput.fUniformHandles.fColorUni.
isValid()) { |
173 // OpenGL ES doesn't support unsigned byte varieties of glUn
iform | 173 // OpenGL ES doesn't support unsigned byte varieties of glUn
iform |
174 GrGLfloat c[4]; | 174 GrGLfloat c[4]; |
175 GrColorToRGBAFloat(color, c); | 175 GrColorToRGBAFloat(color, c); |
176 fUniformManager->set4fv(fBuilderOutput.fUniformHandles.fColo
rUni, 1, c); | 176 fUniformManager->set4fv(fBuilderOutput.fUniformHandles.fColo
rUni, 1, c); |
177 fColor = color; | 177 fColor = color; |
178 } | 178 } |
179 sharedState->fConstAttribColorIndex = -1; | 179 sharedState->fConstAttribColorIndex = -1; |
180 break; | 180 break; |
| 181 case GrGLProgramDesc::kSolidWhite_ColorInput: |
| 182 case GrGLProgramDesc::kTransBlack_ColorInput: |
| 183 sharedState->fConstAttribColorIndex = -1; |
| 184 break; |
181 default: | 185 default: |
182 SkFAIL("Unexpected color type."); | 186 SkFAIL("Unknown color type."); |
183 } | 187 } |
184 } else { | 188 } else { |
185 sharedState->fConstAttribColorIndex = -1; | 189 sharedState->fConstAttribColorIndex = -1; |
186 } | 190 } |
187 } | 191 } |
188 | 192 |
189 void GrGLProgram::setCoverage(const GrDrawState& drawState, | 193 void GrGLProgram::setCoverage(const GrDrawState& drawState, |
190 GrColor coverage, | 194 GrColor coverage, |
191 SharedGLState* sharedState) { | 195 SharedGLState* sharedState) { |
192 const GrGLProgramDesc::KeyHeader& header = fDesc.getHeader(); | 196 const GrGLProgramDesc::KeyHeader& header = fDesc.getHeader(); |
(...skipping 14 matching lines...) Expand all Loading... |
207 if (fCoverage != coverage) { | 211 if (fCoverage != coverage) { |
208 // OpenGL ES doesn't support unsigned byte varieties of glUn
iform | 212 // OpenGL ES doesn't support unsigned byte varieties of glUn
iform |
209 GrGLfloat c[4]; | 213 GrGLfloat c[4]; |
210 GrColorToRGBAFloat(coverage, c); | 214 GrColorToRGBAFloat(coverage, c); |
211 fUniformManager->set4fv(fBuilderOutput.fUniformHandles.fCove
rageUni, 1, c); | 215 fUniformManager->set4fv(fBuilderOutput.fUniformHandles.fCove
rageUni, 1, c); |
212 fCoverage = coverage; | 216 fCoverage = coverage; |
213 } | 217 } |
214 sharedState->fConstAttribCoverageIndex = -1; | 218 sharedState->fConstAttribCoverageIndex = -1; |
215 break; | 219 break; |
216 case GrGLProgramDesc::kSolidWhite_ColorInput: | 220 case GrGLProgramDesc::kSolidWhite_ColorInput: |
| 221 case GrGLProgramDesc::kTransBlack_ColorInput: |
217 sharedState->fConstAttribCoverageIndex = -1; | 222 sharedState->fConstAttribCoverageIndex = -1; |
218 break; | 223 break; |
219 default: | 224 default: |
220 SkFAIL("Unexpected coverage type."); | 225 SkFAIL("Unknown coverage type."); |
221 } | 226 } |
222 } else { | 227 } else { |
223 sharedState->fConstAttribCoverageIndex = -1; | 228 sharedState->fConstAttribCoverageIndex = -1; |
224 } | 229 } |
225 } | 230 } |
226 | 231 |
227 void GrGLProgram::setMatrixAndRenderTargetHeight(const GrDrawState& drawState) { | 232 void GrGLProgram::setMatrixAndRenderTargetHeight(const GrDrawState& drawState) { |
228 const GrRenderTarget* rt = drawState.getRenderTarget(); | 233 const GrRenderTarget* rt = drawState.getRenderTarget(); |
229 SkISize size; | 234 SkISize size; |
230 size.set(rt->width(), rt->height()); | 235 size.set(rt->width(), rt->height()); |
(...skipping 20 matching lines...) Expand all Loading... |
251 | 256 |
252 GrGLfloat viewMatrix[3 * 3]; | 257 GrGLfloat viewMatrix[3 * 3]; |
253 fMatrixState.getGLMatrix<3>(viewMatrix); | 258 fMatrixState.getGLMatrix<3>(viewMatrix); |
254 fUniformManager->setMatrix3f(fBuilderOutput.fUniformHandles.fViewMatrixU
ni, viewMatrix); | 259 fUniformManager->setMatrix3f(fBuilderOutput.fUniformHandles.fViewMatrixU
ni, viewMatrix); |
255 | 260 |
256 GrGLfloat rtAdjustmentVec[4]; | 261 GrGLfloat rtAdjustmentVec[4]; |
257 fMatrixState.getRTAdjustmentVec(rtAdjustmentVec); | 262 fMatrixState.getRTAdjustmentVec(rtAdjustmentVec); |
258 fUniformManager->set4fv(fBuilderOutput.fUniformHandles.fRTAdjustmentUni,
1, rtAdjustmentVec); | 263 fUniformManager->set4fv(fBuilderOutput.fUniformHandles.fRTAdjustmentUni,
1, rtAdjustmentVec); |
259 } | 264 } |
260 } | 265 } |
OLD | NEW |