| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 "GrGLProgramBuilder.h" | 8 #include "GrGLProgramBuilder.h" |
| 9 | 9 |
| 10 #include "GrAutoLocaleSetter.h" | 10 #include "GrAutoLocaleSetter.h" |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 } | 81 } |
| 82 | 82 |
| 83 void GrGLProgramBuilder::emitSamplers(const GrProcessor& processor, | 83 void GrGLProgramBuilder::emitSamplers(const GrProcessor& processor, |
| 84 GrGLSLTextureSampler::TextureSamplerArray*
outSamplers) { | 84 GrGLSLTextureSampler::TextureSamplerArray*
outSamplers) { |
| 85 int numTextures = processor.numTextures(); | 85 int numTextures = processor.numTextures(); |
| 86 UniformHandle* localSamplerUniforms = fSamplerUniforms.push_back_n(numTextur
es); | 86 UniformHandle* localSamplerUniforms = fSamplerUniforms.push_back_n(numTextur
es); |
| 87 SkString name; | 87 SkString name; |
| 88 for (int t = 0; t < numTextures; ++t) { | 88 for (int t = 0; t < numTextures; ++t) { |
| 89 name.printf("Sampler%d", t); | 89 name.printf("Sampler%d", t); |
| 90 GrSLType samplerType = get_sampler_type(processor.textureAccess(t)); | 90 GrSLType samplerType = get_sampler_type(processor.textureAccess(t)); |
| 91 localSamplerUniforms[t] = | 91 localSamplerUniforms[t] = fUniformHandler.addUniform(kFragment_GrShaderF
lag, samplerType, |
| 92 fUniformHandler.addUniform(GrGLSLUniformHandler::kFragment_Visibilit
y, | 92 kDefault_GrSLPrecis
ion, name.c_str()); |
| 93 samplerType, kDefault_GrSLPrecision, | |
| 94 name.c_str()); | |
| 95 outSamplers->emplace_back(localSamplerUniforms[t], processor.textureAcce
ss(t)); | 93 outSamplers->emplace_back(localSamplerUniforms[t], processor.textureAcce
ss(t)); |
| 96 if (kSamplerExternal_GrSLType == samplerType) { | 94 if (kSamplerExternal_GrSLType == samplerType) { |
| 97 const char* externalFeatureString = this->glslCaps()->externalTextur
eExtensionString(); | 95 const char* externalFeatureString = this->glslCaps()->externalTextur
eExtensionString(); |
| 98 // We shouldn't ever create a GrGLTexture that requires external sam
pler type | 96 // We shouldn't ever create a GrGLTexture that requires external sam
pler type |
| 99 SkASSERT(externalFeatureString); | 97 SkASSERT(externalFeatureString); |
| 100 fFS.addFeature(1 << GrGLSLFragmentShaderBuilder::kExternalTexture_GL
SLPrivateFeature, | 98 fFS.addFeature(1 << GrGLSLFragmentShaderBuilder::kExternalTexture_GL
SLPrivateFeature, |
| 101 externalFeatureString); | 99 externalFeatureString); |
| 102 } | 100 } |
| 103 } | 101 } |
| 104 } | 102 } |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 fUniformHandles, | 262 fUniformHandles, |
| 265 programID, | 263 programID, |
| 266 fUniformHandler.fUniforms, | 264 fUniformHandler.fUniforms, |
| 267 fVaryingHandler.fPathProcVaryingInfos, | 265 fVaryingHandler.fPathProcVaryingInfos, |
| 268 fGeometryProcessor, | 266 fGeometryProcessor, |
| 269 fXferProcessor, | 267 fXferProcessor, |
| 270 fFragmentProcessors, | 268 fFragmentProcessors, |
| 271 &fSamplerUniforms); | 269 &fSamplerUniforms); |
| 272 } | 270 } |
| 273 | 271 |
| OLD | NEW |