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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 SkDEBUGCODE( | 55 SkDEBUGCODE( |
56 pathProcVarying.fArrayCount = builderPathProcVarying.fVariable.getAr
rayCount(); | 56 pathProcVarying.fArrayCount = builderPathProcVarying.fVariable.getAr
rayCount(); |
57 pathProcVarying.fType = builderPathProcVarying.fVariable.getType(); | 57 pathProcVarying.fType = builderPathProcVarying.fVariable.getType(); |
58 ); | 58 ); |
59 pathProcVarying.fLocation = builderPathProcVarying.fLocation; | 59 pathProcVarying.fLocation = builderPathProcVarying.fLocation; |
60 } | 60 } |
61 } | 61 } |
62 | 62 |
63 void GrGLProgramDataManager::setSampler(UniformHandle u, int texUnit) const { | 63 void GrGLProgramDataManager::setSampler(UniformHandle u, int texUnit) const { |
64 const Uniform& uni = fUniforms[u.toIndex()]; | 64 const Uniform& uni = fUniforms[u.toIndex()]; |
65 SkASSERT(uni.fType == kSampler2D_GrSLType || uni.fType == kSamplerExternal_G
rSLType); | 65 SkASSERT(uni.fType == kSampler2D_GrSLType); |
66 SkASSERT(GrGLSLShaderVar::kNonArray == uni.fArrayCount); | 66 SkASSERT(GrGLSLShaderVar::kNonArray == uni.fArrayCount); |
67 // FIXME: We still insert a single sampler uniform for every stage. If the s
hader does not | 67 // FIXME: We still insert a single sampler uniform for every stage. If the s
hader does not |
68 // reference the sampler then the compiler may have optimized it out. Uncomm
ent this assert | 68 // reference the sampler then the compiler may have optimized it out. Uncomm
ent this assert |
69 // once stages insert their own samplers. | 69 // once stages insert their own samplers. |
70 // this->printUnused(uni); | 70 // this->printUnused(uni); |
71 if (kUnusedUniform != uni.fFSLocation) { | 71 if (kUnusedUniform != uni.fFSLocation) { |
72 GR_GL_CALL(fGpu->glInterface(), Uniform1i(uni.fFSLocation, texUnit)); | 72 GR_GL_CALL(fGpu->glInterface(), Uniform1i(uni.fFSLocation, texUnit)); |
73 } | 73 } |
74 if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation)
{ | 74 if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation)
{ |
75 GR_GL_CALL(fGpu->glInterface(), Uniform1i(uni.fVSLocation, texUnit)); | 75 GR_GL_CALL(fGpu->glInterface(), Uniform1i(uni.fVSLocation, texUnit)); |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 matrix); | 292 matrix); |
293 } | 293 } |
294 | 294 |
295 #ifdef SK_DEBUG | 295 #ifdef SK_DEBUG |
296 void GrGLProgramDataManager::printUnused(const Uniform& uni) const { | 296 void GrGLProgramDataManager::printUnused(const Uniform& uni) const { |
297 if (kUnusedUniform == uni.fFSLocation && kUnusedUniform == uni.fVSLocation)
{ | 297 if (kUnusedUniform == uni.fFSLocation && kUnusedUniform == uni.fVSLocation)
{ |
298 GrCapsDebugf(fGpu->caps(), "Unused uniform in shader\n"); | 298 GrCapsDebugf(fGpu->caps(), "Unused uniform in shader\n"); |
299 } | 299 } |
300 } | 300 } |
301 #endif | 301 #endif |
OLD | NEW |