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