| 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(uni.fType == kSampler2D_GrSLType || uni.fType == kSamplerExternal_G
rSLType || |
| 67 uni.fType == kSampler2DRect_GrSLType); |
| 67 SkASSERT(GrGLSLShaderVar::kNonArray == uni.fArrayCount); | 68 SkASSERT(GrGLSLShaderVar::kNonArray == uni.fArrayCount); |
| 68 // FIXME: We still insert a single sampler uniform for every stage. If the s
hader does not | 69 // FIXME: We still insert a single sampler uniform for every stage. If the s
hader does not |
| 69 // reference the sampler then the compiler may have optimized it out. Uncomm
ent this assert | 70 // reference the sampler then the compiler may have optimized it out. Uncomm
ent this assert |
| 70 // once stages insert their own samplers. | 71 // once stages insert their own samplers. |
| 71 // this->printUnused(uni); | 72 // this->printUnused(uni); |
| 72 if (kUnusedUniform != uni.fFSLocation) { | 73 if (kUnusedUniform != uni.fFSLocation) { |
| 73 GR_GL_CALL(fGpu->glInterface(), Uniform1i(uni.fFSLocation, texUnit)); | 74 GR_GL_CALL(fGpu->glInterface(), Uniform1i(uni.fFSLocation, texUnit)); |
| 74 } | 75 } |
| 75 if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation)
{ | 76 if (kUnusedUniform != uni.fVSLocation && uni.fVSLocation != uni.fFSLocation)
{ |
| 76 GR_GL_CALL(fGpu->glInterface(), Uniform1i(uni.fVSLocation, texUnit)); | 77 GR_GL_CALL(fGpu->glInterface(), Uniform1i(uni.fVSLocation, texUnit)); |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 matrix); | 294 matrix); |
| 294 } | 295 } |
| 295 | 296 |
| 296 #ifdef SK_DEBUG | 297 #ifdef SK_DEBUG |
| 297 void GrGLProgramDataManager::printUnused(const Uniform& uni) const { | 298 void GrGLProgramDataManager::printUnused(const Uniform& uni) const { |
| 298 if (kUnusedUniform == uni.fFSLocation && kUnusedUniform == uni.fVSLocation)
{ | 299 if (kUnusedUniform == uni.fFSLocation && kUnusedUniform == uni.fVSLocation)
{ |
| 299 GrCapsDebugf(fGpu->caps(), "Unused uniform in shader\n"); | 300 GrCapsDebugf(fGpu->caps(), "Unused uniform in shader\n"); |
| 300 } | 301 } |
| 301 } | 302 } |
| 302 #endif | 303 #endif |
| OLD | NEW |