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 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 GL_CALL(VertexAttrib4fv(header.fColorAttributeIndex, c)); | 265 GL_CALL(VertexAttrib4fv(header.fColorAttributeIndex, c)); |
266 sharedState->fConstAttribColor = color; | 266 sharedState->fConstAttribColor = color; |
267 sharedState->fConstAttribColorIndex = header.fColorAttribute
Index; | 267 sharedState->fConstAttribColorIndex = header.fColorAttribute
Index; |
268 } | 268 } |
269 break; | 269 break; |
270 case GrGLProgramDesc::kUniform_ColorInput: | 270 case GrGLProgramDesc::kUniform_ColorInput: |
271 if (fColor != color && fUniformHandles.fColorUni.isValid()) { | 271 if (fColor != color && fUniformHandles.fColorUni.isValid()) { |
272 // OpenGL ES doesn't support unsigned byte varieties of glUn
iform | 272 // OpenGL ES doesn't support unsigned byte varieties of glUn
iform |
273 GrGLfloat c[4]; | 273 GrGLfloat c[4]; |
274 GrColorToRGBAFloat(color, c); | 274 GrColorToRGBAFloat(color, c); |
275 fUniformManager.set4fv(fUniformHandles.fColorUni, 0, 1, c); | 275 fUniformManager.set4fv(fUniformHandles.fColorUni, 1, c); |
276 fColor = color; | 276 fColor = color; |
277 } | 277 } |
278 sharedState->fConstAttribColorIndex = -1; | 278 sharedState->fConstAttribColorIndex = -1; |
279 break; | 279 break; |
280 case GrGLProgramDesc::kSolidWhite_ColorInput: | 280 case GrGLProgramDesc::kSolidWhite_ColorInput: |
281 case GrGLProgramDesc::kTransBlack_ColorInput: | 281 case GrGLProgramDesc::kTransBlack_ColorInput: |
282 sharedState->fConstAttribColorIndex = -1; | 282 sharedState->fConstAttribColorIndex = -1; |
283 break; | 283 break; |
284 default: | 284 default: |
285 GrCrash("Unknown color type."); | 285 GrCrash("Unknown color type."); |
(...skipping 18 matching lines...) Expand all Loading... |
304 GL_CALL(VertexAttrib4fv(header.fCoverageAttributeIndex, c)); | 304 GL_CALL(VertexAttrib4fv(header.fCoverageAttributeIndex, c)); |
305 sharedState->fConstAttribCoverage = coverage; | 305 sharedState->fConstAttribCoverage = coverage; |
306 sharedState->fConstAttribCoverageIndex = header.fCoverageAtt
ributeIndex; | 306 sharedState->fConstAttribCoverageIndex = header.fCoverageAtt
ributeIndex; |
307 } | 307 } |
308 break; | 308 break; |
309 case GrGLProgramDesc::kUniform_ColorInput: | 309 case GrGLProgramDesc::kUniform_ColorInput: |
310 if (fCoverage != coverage) { | 310 if (fCoverage != coverage) { |
311 // OpenGL ES doesn't support unsigned byte varieties of glUn
iform | 311 // OpenGL ES doesn't support unsigned byte varieties of glUn
iform |
312 GrGLfloat c[4]; | 312 GrGLfloat c[4]; |
313 GrColorToRGBAFloat(coverage, c); | 313 GrColorToRGBAFloat(coverage, c); |
314 fUniformManager.set4fv(fUniformHandles.fCoverageUni, 0, 1, c
); | 314 fUniformManager.set4fv(fUniformHandles.fCoverageUni, 1, c); |
315 fCoverage = coverage; | 315 fCoverage = coverage; |
316 } | 316 } |
317 sharedState->fConstAttribCoverageIndex = -1; | 317 sharedState->fConstAttribCoverageIndex = -1; |
318 break; | 318 break; |
319 case GrGLProgramDesc::kSolidWhite_ColorInput: | 319 case GrGLProgramDesc::kSolidWhite_ColorInput: |
320 case GrGLProgramDesc::kTransBlack_ColorInput: | 320 case GrGLProgramDesc::kTransBlack_ColorInput: |
321 sharedState->fConstAttribCoverageIndex = -1; | 321 sharedState->fConstAttribCoverageIndex = -1; |
322 break; | 322 break; |
323 default: | 323 default: |
324 GrCrash("Unknown coverage type."); | 324 GrCrash("Unknown coverage type."); |
(...skipping 24 matching lines...) Expand all Loading... |
349 | 349 |
350 fMatrixState.fViewMatrix = drawState.getViewMatrix(); | 350 fMatrixState.fViewMatrix = drawState.getViewMatrix(); |
351 fMatrixState.fRenderTargetSize = size; | 351 fMatrixState.fRenderTargetSize = size; |
352 fMatrixState.fRenderTargetOrigin = rt->origin(); | 352 fMatrixState.fRenderTargetOrigin = rt->origin(); |
353 | 353 |
354 GrGLfloat viewMatrix[3 * 3]; | 354 GrGLfloat viewMatrix[3 * 3]; |
355 fMatrixState.getGLMatrix<3>(viewMatrix); | 355 fMatrixState.getGLMatrix<3>(viewMatrix); |
356 fUniformManager.setMatrix3f(fUniformHandles.fViewMatrixUni, viewMatrix); | 356 fUniformManager.setMatrix3f(fUniformHandles.fViewMatrixUni, viewMatrix); |
357 } | 357 } |
358 } | 358 } |
OLD | NEW |