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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 SkASSERT(GrGLSLShaderVar::kNonArray == uni.fArrayCount); | 95 SkASSERT(GrGLSLShaderVar::kNonArray == uni.fArrayCount); |
96 SkDEBUGCODE(this->printUnused(uni)); | 96 SkDEBUGCODE(this->printUnused(uni)); |
97 if (kUnusedUniform != uni.fFSLocation) { | 97 if (kUnusedUniform != uni.fFSLocation) { |
98 GR_GL_CALL(fGpu->glInterface(), Uniform1i(uni.fFSLocation, i)); | 98 GR_GL_CALL(fGpu->glInterface(), Uniform1i(uni.fFSLocation, i)); |
99 } | 99 } |
100 if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation)
{ | 100 if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation)
{ |
101 GR_GL_CALL(fGpu->glInterface(), Uniform1i(uni.fVSLocation, i)); | 101 GR_GL_CALL(fGpu->glInterface(), Uniform1i(uni.fVSLocation, i)); |
102 } | 102 } |
103 } | 103 } |
104 | 104 |
| 105 void GrGLProgramDataManager::set1iv(UniformHandle u, |
| 106 int arrayCount, |
| 107 const int v[]) const { |
| 108 const Uniform& uni = fUniforms[u.toIndex()]; |
| 109 SkASSERT(uni.fType == kInt_GrSLType); |
| 110 SkASSERT(arrayCount > 0); |
| 111 ASSERT_ARRAY_UPLOAD_IN_BOUNDS(uni, arrayCount); |
| 112 if (kUnusedUniform != uni.fFSLocation) { |
| 113 GR_GL_CALL(fGpu->glInterface(), Uniform1iv(uni.fFSLocation, arrayCount,
v)); |
| 114 } |
| 115 if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation)
{ |
| 116 GR_GL_CALL(fGpu->glInterface(), Uniform1iv(uni.fVSLocation, arrayCount,
v)); |
| 117 } |
| 118 } |
| 119 |
105 void GrGLProgramDataManager::set1f(UniformHandle u, float v0) const { | 120 void GrGLProgramDataManager::set1f(UniformHandle u, float v0) const { |
106 const Uniform& uni = fUniforms[u.toIndex()]; | 121 const Uniform& uni = fUniforms[u.toIndex()]; |
107 SkASSERT(uni.fType == kFloat_GrSLType); | 122 SkASSERT(uni.fType == kFloat_GrSLType); |
108 SkASSERT(GrGLSLShaderVar::kNonArray == uni.fArrayCount); | 123 SkASSERT(GrGLSLShaderVar::kNonArray == uni.fArrayCount); |
109 SkDEBUGCODE(this->printUnused(uni);) | 124 SkDEBUGCODE(this->printUnused(uni);) |
110 if (kUnusedUniform != uni.fFSLocation) { | 125 if (kUnusedUniform != uni.fFSLocation) { |
111 GR_GL_CALL(fGpu->glInterface(), Uniform1f(uni.fFSLocation, v0)); | 126 GR_GL_CALL(fGpu->glInterface(), Uniform1f(uni.fFSLocation, v0)); |
112 } | 127 } |
113 if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation)
{ | 128 if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation)
{ |
114 GR_GL_CALL(fGpu->glInterface(), Uniform1f(uni.fVSLocation, v0)); | 129 GR_GL_CALL(fGpu->glInterface(), Uniform1f(uni.fVSLocation, v0)); |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 matrix); | 316 matrix); |
302 } | 317 } |
303 | 318 |
304 #ifdef SK_DEBUG | 319 #ifdef SK_DEBUG |
305 void GrGLProgramDataManager::printUnused(const Uniform& uni) const { | 320 void GrGLProgramDataManager::printUnused(const Uniform& uni) const { |
306 if (kUnusedUniform == uni.fFSLocation && kUnusedUniform == uni.fVSLocation)
{ | 321 if (kUnusedUniform == uni.fFSLocation && kUnusedUniform == uni.fVSLocation)
{ |
307 GrCapsDebugf(fGpu->caps(), "Unused uniform in shader\n"); | 322 GrCapsDebugf(fGpu->caps(), "Unused uniform in shader\n"); |
308 } | 323 } |
309 } | 324 } |
310 #endif | 325 #endif |
OLD | NEW |