| Index: src/gpu/gl/builders/GrGLProgramBuilder.cpp
|
| diff --git a/src/gpu/gl/builders/GrGLProgramBuilder.cpp b/src/gpu/gl/builders/GrGLProgramBuilder.cpp
|
| index 0ae4f961015a273dc8152258e1e6a3f46df4e323..b5108a74d0fcfb7abe188e6d38575ba7b07f5370 100644
|
| --- a/src/gpu/gl/builders/GrGLProgramBuilder.cpp
|
| +++ b/src/gpu/gl/builders/GrGLProgramBuilder.cpp
|
| @@ -319,6 +319,16 @@ void GrGLProgramBuilder::verify(const GrFragmentProcessor& fp) {
|
| SkASSERT(fFS.hasReadFragmentPosition() == fp.willReadFragmentPosition());
|
| }
|
|
|
| +static GrSLType get_sampler_type(const GrTextureAccess& access) {
|
| + GrGLTexture* glTexture = static_cast<GrGLTexture*>(access.getTexture());
|
| + if (glTexture->target() == GR_GL_TEXTURE_EXTERNAL) {
|
| + return kSamplerExternal_GrSLType;
|
| + } else {
|
| + SkASSERT(glTexture->target() == GR_GL_TEXTURE_2D);
|
| + return kSampler2D_GrSLType;
|
| + }
|
| +}
|
| +
|
| template <class Proc>
|
| void GrGLProgramBuilder::emitSamplers(const GrProcessor& processor,
|
| GrGLSLTextureSampler::TextureSamplerArray* outSamplers,
|
| @@ -329,11 +339,19 @@ void GrGLProgramBuilder::emitSamplers(const GrProcessor& processor,
|
| SkString name;
|
| for (int t = 0; t < numTextures; ++t) {
|
| name.printf("Sampler%d", t);
|
| + GrSLType samplerType = get_sampler_type(processor.textureAccess(t));
|
| localSamplerUniforms[t] = this->addUniform(GrGLProgramBuilder::kFragment_Visibility,
|
| - kSampler2D_GrSLType, kDefault_GrSLPrecision,
|
| + samplerType, kDefault_GrSLPrecision,
|
| name.c_str());
|
| SkNEW_APPEND_TO_TARRAY(outSamplers, GrGLSLTextureSampler,
|
| (localSamplerUniforms[t], processor.textureAccess(t)));
|
| + if (kSamplerExternal_GrSLType == samplerType) {
|
| + const char* externalFeatureString = this->glslCaps()->externalTextureExtensionString();
|
| + // We shouldn't ever create a GrGLTexture that requires external sampler type
|
| + SkASSERT(externalFeatureString);
|
| + fFS.addFeature(1 << GrGLSLFragmentShaderBuilder::kExternalTexture_GLSLPrivateFeature,
|
| + externalFeatureString);
|
| + }
|
| }
|
| }
|
|
|
|
|