| 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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 // this->printUnused(uni); | 82 // this->printUnused(uni); |
| 83 if (kUnusedUniform != fsLocation) { | 83 if (kUnusedUniform != fsLocation) { |
| 84 GR_GL_CALL(fGpu->glInterface(), Uniform1i(fsLocation, i)); | 84 GR_GL_CALL(fGpu->glInterface(), Uniform1i(fsLocation, i)); |
| 85 } | 85 } |
| 86 if (kUnusedUniform != vsLocation && vsLocation != fsLocation) { | 86 if (kUnusedUniform != vsLocation && vsLocation != fsLocation) { |
| 87 GR_GL_CALL(fGpu->glInterface(), Uniform1i(vsLocation, i)); | 87 GR_GL_CALL(fGpu->glInterface(), Uniform1i(vsLocation, i)); |
| 88 } | 88 } |
| 89 } | 89 } |
| 90 } | 90 } |
| 91 | 91 |
| 92 void GrGLProgramDataManager::set1i(UniformHandle u, int i) const { | |
| 93 const Uniform& uni = fUniforms[u.toIndex()]; | |
| 94 SkASSERT(uni.fType == kInt_GrSLType); | |
| 95 SkASSERT(GrGLSLShaderVar::kNonArray == uni.fArrayCount); | |
| 96 SkDEBUGCODE(this->printUnused(uni)); | |
| 97 if (kUnusedUniform != uni.fFSLocation) { | |
| 98 GR_GL_CALL(fGpu->glInterface(), Uniform1i(uni.fFSLocation, i)); | |
| 99 } | |
| 100 if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation)
{ | |
| 101 GR_GL_CALL(fGpu->glInterface(), Uniform1i(uni.fVSLocation, i)); | |
| 102 } | |
| 103 } | |
| 104 | |
| 105 void GrGLProgramDataManager::set1f(UniformHandle u, float v0) const { | 92 void GrGLProgramDataManager::set1f(UniformHandle u, float v0) const { |
| 106 const Uniform& uni = fUniforms[u.toIndex()]; | 93 const Uniform& uni = fUniforms[u.toIndex()]; |
| 107 SkASSERT(uni.fType == kFloat_GrSLType); | 94 SkASSERT(uni.fType == kFloat_GrSLType); |
| 108 SkASSERT(GrGLSLShaderVar::kNonArray == uni.fArrayCount); | 95 SkASSERT(GrGLSLShaderVar::kNonArray == uni.fArrayCount); |
| 109 SkDEBUGCODE(this->printUnused(uni);) | 96 SkDEBUGCODE(this->printUnused(uni);) |
| 110 if (kUnusedUniform != uni.fFSLocation) { | 97 if (kUnusedUniform != uni.fFSLocation) { |
| 111 GR_GL_CALL(fGpu->glInterface(), Uniform1f(uni.fFSLocation, v0)); | 98 GR_GL_CALL(fGpu->glInterface(), Uniform1f(uni.fFSLocation, v0)); |
| 112 } | 99 } |
| 113 if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation)
{ | 100 if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation)
{ |
| 114 GR_GL_CALL(fGpu->glInterface(), Uniform1f(uni.fVSLocation, v0)); | 101 GR_GL_CALL(fGpu->glInterface(), Uniform1f(uni.fVSLocation, v0)); |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 matrix); | 288 matrix); |
| 302 } | 289 } |
| 303 | 290 |
| 304 #ifdef SK_DEBUG | 291 #ifdef SK_DEBUG |
| 305 void GrGLProgramDataManager::printUnused(const Uniform& uni) const { | 292 void GrGLProgramDataManager::printUnused(const Uniform& uni) const { |
| 306 if (kUnusedUniform == uni.fFSLocation && kUnusedUniform == uni.fVSLocation)
{ | 293 if (kUnusedUniform == uni.fFSLocation && kUnusedUniform == uni.fVSLocation)
{ |
| 307 GrCapsDebugf(fGpu->caps(), "Unused uniform in shader\n"); | 294 GrCapsDebugf(fGpu->caps(), "Unused uniform in shader\n"); |
| 308 } | 295 } |
| 309 } | 296 } |
| 310 #endif | 297 #endif |
| OLD | NEW |