| 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 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 case GrGLProgramDesc::kUniform_ColorInput: | 181 case GrGLProgramDesc::kUniform_ColorInput: |
| 182 if (fColor != color && fBuiltinUniformHandles.fColorUni.isValid(
)) { | 182 if (fColor != color && fBuiltinUniformHandles.fColorUni.isValid(
)) { |
| 183 // OpenGL ES doesn't support unsigned byte varieties of glUn
iform | 183 // OpenGL ES doesn't support unsigned byte varieties of glUn
iform |
| 184 GrGLfloat c[4]; | 184 GrGLfloat c[4]; |
| 185 GrColorToRGBAFloat(color, c); | 185 GrColorToRGBAFloat(color, c); |
| 186 fProgramDataManager.set4fv(fBuiltinUniformHandles.fColorUni,
1, c); | 186 fProgramDataManager.set4fv(fBuiltinUniformHandles.fColorUni,
1, c); |
| 187 fColor = color; | 187 fColor = color; |
| 188 } | 188 } |
| 189 sharedState->fConstAttribColorIndex = -1; | 189 sharedState->fConstAttribColorIndex = -1; |
| 190 break; | 190 break; |
| 191 case GrGLProgramDesc::kAllOnes_ColorInput: |
| 192 sharedState->fConstAttribColorIndex = -1; |
| 193 break; |
| 191 default: | 194 default: |
| 192 SkFAIL("Unexpected color type."); | 195 SkFAIL("Unexpected color type."); |
| 193 } | 196 } |
| 194 } else { | 197 } else { |
| 195 sharedState->fConstAttribColorIndex = -1; | 198 sharedState->fConstAttribColorIndex = -1; |
| 196 } | 199 } |
| 197 } | 200 } |
| 198 | 201 |
| 199 void GrGLProgram::setCoverage(const GrDrawState& drawState, | 202 void GrGLProgram::setCoverage(const GrDrawState& drawState, |
| 200 GrColor coverage, | 203 GrColor coverage, |
| (...skipping 15 matching lines...) Expand all Loading... |
| 216 case GrGLProgramDesc::kUniform_ColorInput: | 219 case GrGLProgramDesc::kUniform_ColorInput: |
| 217 if (fCoverage != coverage) { | 220 if (fCoverage != coverage) { |
| 218 // OpenGL ES doesn't support unsigned byte varieties of glUn
iform | 221 // OpenGL ES doesn't support unsigned byte varieties of glUn
iform |
| 219 GrGLfloat c[4]; | 222 GrGLfloat c[4]; |
| 220 GrColorToRGBAFloat(coverage, c); | 223 GrColorToRGBAFloat(coverage, c); |
| 221 fProgramDataManager.set4fv(fBuiltinUniformHandles.fCoverageU
ni, 1, c); | 224 fProgramDataManager.set4fv(fBuiltinUniformHandles.fCoverageU
ni, 1, c); |
| 222 fCoverage = coverage; | 225 fCoverage = coverage; |
| 223 } | 226 } |
| 224 sharedState->fConstAttribCoverageIndex = -1; | 227 sharedState->fConstAttribCoverageIndex = -1; |
| 225 break; | 228 break; |
| 226 case GrGLProgramDesc::kSolidWhite_ColorInput: | 229 case GrGLProgramDesc::kAllOnes_ColorInput: |
| 227 sharedState->fConstAttribCoverageIndex = -1; | 230 sharedState->fConstAttribCoverageIndex = -1; |
| 228 break; | 231 break; |
| 229 default: | 232 default: |
| 230 SkFAIL("Unexpected coverage type."); | 233 SkFAIL("Unexpected coverage type."); |
| 231 } | 234 } |
| 232 } else { | 235 } else { |
| 233 sharedState->fConstAttribCoverageIndex = -1; | 236 sharedState->fConstAttribCoverageIndex = -1; |
| 234 } | 237 } |
| 235 } | 238 } |
| 236 | 239 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 260 | 263 |
| 261 GrGLfloat viewMatrix[3 * 3]; | 264 GrGLfloat viewMatrix[3 * 3]; |
| 262 fMatrixState.getGLMatrix<3>(viewMatrix); | 265 fMatrixState.getGLMatrix<3>(viewMatrix); |
| 263 fProgramDataManager.setMatrix3f(fBuiltinUniformHandles.fViewMatrixUni, v
iewMatrix); | 266 fProgramDataManager.setMatrix3f(fBuiltinUniformHandles.fViewMatrixUni, v
iewMatrix); |
| 264 | 267 |
| 265 GrGLfloat rtAdjustmentVec[4]; | 268 GrGLfloat rtAdjustmentVec[4]; |
| 266 fMatrixState.getRTAdjustmentVec(rtAdjustmentVec); | 269 fMatrixState.getRTAdjustmentVec(rtAdjustmentVec); |
| 267 fProgramDataManager.set4fv(fBuiltinUniformHandles.fRTAdjustmentUni, 1, r
tAdjustmentVec); | 270 fProgramDataManager.set4fv(fBuiltinUniformHandles.fRTAdjustmentUni, 1, r
tAdjustmentVec); |
| 268 } | 271 } |
| 269 } | 272 } |
| OLD | NEW |