| 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 | 8 |
| 9 #include "GrGpuGL.h" | 9 #include "GrGpuGL.h" |
| 10 #include "GrGLStencilBuffer.h" | 10 #include "GrGLStencilBuffer.h" |
| (...skipping 2090 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2101 GL_CALL(LoadMatrixf(glMatrix)); | 2101 GL_CALL(LoadMatrixf(glMatrix)); |
| 2102 } | 2102 } |
| 2103 | 2103 |
| 2104 void GrGpuGL::enableTexGen(int unitIdx, | 2104 void GrGpuGL::enableTexGen(int unitIdx, |
| 2105 TexGenComponents components, | 2105 TexGenComponents components, |
| 2106 const GrGLfloat* coefficients) { | 2106 const GrGLfloat* coefficients) { |
| 2107 | 2107 |
| 2108 SkASSERT(this->glCaps().fixedFunctionSupport()); | 2108 SkASSERT(this->glCaps().fixedFunctionSupport()); |
| 2109 SkASSERT(this->caps()->pathRenderingSupport()); | 2109 SkASSERT(this->caps()->pathRenderingSupport()); |
| 2110 SkASSERT(components >= kS_TexGenComponents && components <= kSTR_TexGenCompo
nents); | 2110 SkASSERT(components >= kS_TexGenComponents && components <= kSTR_TexGenCompo
nents); |
| 2111 SkASSERT(this->glCaps().maxFixedFunctionTextureCoords() >= unitIdx); |
| 2111 | 2112 |
| 2112 if (GR_GL_OBJECT_LINEAR == fHWTexGenSettings[unitIdx].fMode && | 2113 if (GR_GL_OBJECT_LINEAR == fHWTexGenSettings[unitIdx].fMode && |
| 2113 components == fHWTexGenSettings[unitIdx].fNumComponents && | 2114 components == fHWTexGenSettings[unitIdx].fNumComponents && |
| 2114 !memcmp(coefficients, fHWTexGenSettings[unitIdx].fCoefficients, | 2115 !memcmp(coefficients, fHWTexGenSettings[unitIdx].fCoefficients, |
| 2115 3 * components * sizeof(GrGLfloat))) { | 2116 3 * components * sizeof(GrGLfloat))) { |
| 2116 return; | 2117 return; |
| 2117 } | 2118 } |
| 2118 | 2119 |
| 2119 this->setTextureUnit(unitIdx); | 2120 this->setTextureUnit(unitIdx); |
| 2120 | 2121 |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2173 coefficients[7] = SkScalarToFloat(matrix[SkMatrix::kMPersp1]); | 2174 coefficients[7] = SkScalarToFloat(matrix[SkMatrix::kMPersp1]); |
| 2174 coefficients[8] = SkScalarToFloat(matrix[SkMatrix::kMPersp2]); | 2175 coefficients[8] = SkScalarToFloat(matrix[SkMatrix::kMPersp2]); |
| 2175 } | 2176 } |
| 2176 | 2177 |
| 2177 enableTexGen(unitIdx, components, coefficients); | 2178 enableTexGen(unitIdx, components, coefficients); |
| 2178 } | 2179 } |
| 2179 | 2180 |
| 2180 void GrGpuGL::disableUnusedTexGen(int numUsedTexCoordSets) { | 2181 void GrGpuGL::disableUnusedTexGen(int numUsedTexCoordSets) { |
| 2181 | 2182 |
| 2182 SkASSERT(this->glCaps().fixedFunctionSupport()); | 2183 SkASSERT(this->glCaps().fixedFunctionSupport()); |
| 2184 SkASSERT(this->glCaps().maxFixedFunctionTextureCoords() >= numUsedTexCoordSe
ts); |
| 2183 | 2185 |
| 2184 for (int i = numUsedTexCoordSets; i < fHWActiveTexGenSets; i++) { | 2186 for (int i = numUsedTexCoordSets; i < fHWActiveTexGenSets; i++) { |
| 2185 if (0 == fHWTexGenSettings[i].fNumComponents) { | 2187 if (0 == fHWTexGenSettings[i].fNumComponents) { |
| 2186 continue; | 2188 continue; |
| 2187 } | 2189 } |
| 2188 | 2190 |
| 2189 this->setTextureUnit(i); | 2191 this->setTextureUnit(i); |
| 2190 for (int j = 0; j < fHWTexGenSettings[i].fNumComponents; j++) { | 2192 for (int j = 0; j < fHWTexGenSettings[i].fNumComponents; j++) { |
| 2191 GL_CALL(Disable(GR_GL_TEXTURE_GEN_S + j)); | 2193 GL_CALL(Disable(GR_GL_TEXTURE_GEN_S + j)); |
| 2192 } | 2194 } |
| (...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2675 this->setVertexArrayID(gpu, 0); | 2677 this->setVertexArrayID(gpu, 0); |
| 2676 } | 2678 } |
| 2677 int attrCount = gpu->glCaps().maxVertexAttributes(); | 2679 int attrCount = gpu->glCaps().maxVertexAttributes(); |
| 2678 if (fDefaultVertexArrayAttribState.count() != attrCount) { | 2680 if (fDefaultVertexArrayAttribState.count() != attrCount) { |
| 2679 fDefaultVertexArrayAttribState.resize(attrCount); | 2681 fDefaultVertexArrayAttribState.resize(attrCount); |
| 2680 } | 2682 } |
| 2681 attribState = &fDefaultVertexArrayAttribState; | 2683 attribState = &fDefaultVertexArrayAttribState; |
| 2682 } | 2684 } |
| 2683 return attribState; | 2685 return attribState; |
| 2684 } | 2686 } |
| OLD | NEW |