| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 "SkMatrix.h" | 8 #include "SkMatrix.h" |
| 9 #include "gl/GrGLProgramDataManager.h" | 9 #include "gl/GrGLProgramDataManager.h" |
| 10 #include "gl/GrGLGpu.h" | 10 #include "gl/GrGLGpu.h" |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 if (kUnusedUniform != uni.fFSLocation) { | 256 if (kUnusedUniform != uni.fFSLocation) { |
| 257 GR_GL_CALL(fGpu->glInterface(), | 257 GR_GL_CALL(fGpu->glInterface(), |
| 258 UniformMatrix4fv(uni.fFSLocation, arrayCount, false, matrices
)); | 258 UniformMatrix4fv(uni.fFSLocation, arrayCount, false, matrices
)); |
| 259 } | 259 } |
| 260 if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation)
{ | 260 if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation)
{ |
| 261 GR_GL_CALL(fGpu->glInterface(), | 261 GR_GL_CALL(fGpu->glInterface(), |
| 262 UniformMatrix4fv(uni.fVSLocation, arrayCount, false, matrices
)); | 262 UniformMatrix4fv(uni.fVSLocation, arrayCount, false, matrices
)); |
| 263 } | 263 } |
| 264 } | 264 } |
| 265 | 265 |
| 266 void GrGLProgramDataManager::setSkMatrix(UniformHandle u, const SkMatrix& matrix
) const { | |
| 267 float mt[] = { | |
| 268 matrix.get(SkMatrix::kMScaleX), | |
| 269 matrix.get(SkMatrix::kMSkewY), | |
| 270 matrix.get(SkMatrix::kMPersp0), | |
| 271 matrix.get(SkMatrix::kMSkewX), | |
| 272 matrix.get(SkMatrix::kMScaleY), | |
| 273 matrix.get(SkMatrix::kMPersp1), | |
| 274 matrix.get(SkMatrix::kMTransX), | |
| 275 matrix.get(SkMatrix::kMTransY), | |
| 276 matrix.get(SkMatrix::kMPersp2), | |
| 277 }; | |
| 278 this->setMatrix3f(u, mt); | |
| 279 } | |
| 280 | |
| 281 void GrGLProgramDataManager::setPathFragmentInputTransform(VaryingHandle u, | 266 void GrGLProgramDataManager::setPathFragmentInputTransform(VaryingHandle u, |
| 282 int components, | 267 int components, |
| 283 const SkMatrix& matri
x) const { | 268 const SkMatrix& matri
x) const { |
| 284 SkASSERT(fGpu->glCaps().shaderCaps()->pathRenderingSupport()); | 269 SkASSERT(fGpu->glCaps().shaderCaps()->pathRenderingSupport()); |
| 285 const PathProcVarying& fragmentInput = fPathProcVaryings[u.toIndex()]; | 270 const PathProcVarying& fragmentInput = fPathProcVaryings[u.toIndex()]; |
| 286 | 271 |
| 287 SkASSERT((components == 2 && fragmentInput.fType == kVec2f_GrSLType) || | 272 SkASSERT((components == 2 && fragmentInput.fType == kVec2f_GrSLType) || |
| 288 (components == 3 && fragmentInput.fType == kVec3f_GrSLType)); | 273 (components == 3 && fragmentInput.fType == kVec3f_GrSLType)); |
| 289 | 274 |
| 290 fGpu->glPathRendering()->setProgramPathFragmentInputTransform(fProgramID, | 275 fGpu->glPathRendering()->setProgramPathFragmentInputTransform(fProgramID, |
| 291 fragmentInput.
fLocation, | 276 fragmentInput.
fLocation, |
| 292 GR_GL_OBJECT_L
INEAR, | 277 GR_GL_OBJECT_L
INEAR, |
| 293 components, | 278 components, |
| 294 matrix); | 279 matrix); |
| 295 } | 280 } |
| 296 | 281 |
| 297 #ifdef SK_DEBUG | 282 #ifdef SK_DEBUG |
| 298 void GrGLProgramDataManager::printUnused(const Uniform& uni) const { | 283 void GrGLProgramDataManager::printUnused(const Uniform& uni) const { |
| 299 if (kUnusedUniform == uni.fFSLocation && kUnusedUniform == uni.fVSLocation)
{ | 284 if (kUnusedUniform == uni.fFSLocation && kUnusedUniform == uni.fVSLocation)
{ |
| 300 GrCapsDebugf(fGpu->caps(), "Unused uniform in shader\n"); | 285 GrCapsDebugf(fGpu->caps(), "Unused uniform in shader\n"); |
| 301 } | 286 } |
| 302 } | 287 } |
| 303 #endif | 288 #endif |
| OLD | NEW |