Index: src/gpu/gl/GrGLCaps.cpp |
diff --git a/src/gpu/gl/GrGLCaps.cpp b/src/gpu/gl/GrGLCaps.cpp |
index c2ace6cd368948d25d60f95b766895dcfd1ce740..d94f4876214f5457bde7547ef1a3d2e314a26b54 100644 |
--- a/src/gpu/gl/GrGLCaps.cpp |
+++ b/src/gpu/gl/GrGLCaps.cpp |
@@ -226,13 +226,19 @@ void GrGLCaps::init(const GrContextOptions& contextOptions, |
} |
} |
- if ((kGL_GrGLStandard == standard && version >= GR_GL_VER(3, 1)) || |
- ctxInfo.hasExtension("GL_ARB_texture_rectangle")) { |
- // We also require textureSize() support for rectangle 2D samplers which was added in GLSL |
- // 1.40. |
- if (ctxInfo.glslGeneration() >= k140_GrGLSLGeneration) { |
- fRectangleTextureSupport = true; |
+ if (kGL_GrGLStandard == standard) { |
+ if (version >= GR_GL_VER(3, 1) || ctxInfo.hasExtension("GL_ARB_texture_rectangle")) { |
+ // We also require textureSize() support for rectangle 2D samplers which was added in |
+ // GLSL 1.40. |
+ if (ctxInfo.glslGeneration() >= k140_GrGLSLGeneration) { |
+ fRectangleTextureSupport = true; |
+ } |
} |
+ } else { |
+ // Command buffer exposes this in GL ES context for Chromium reasons, |
+ // but it should not be used. Also, at the time of writing command buffer |
+ // lacks TexImage2D support and ANGLE lacks GL ES 3.0 support. |
+ fRectangleTextureSupport = ctxInfo.hasExtension("GL_ARB_texture_rectangle"); |
} |
if (kGL_GrGLStandard == standard) { |
@@ -632,6 +638,25 @@ void GrGLCaps::initGLSL(const GrGLContextInfo& ctxInfo) { |
glslCaps->fExternalTextureExtensionString = "GL_OES_EGL_image_external_essl3"; |
} |
} |
+ if (fRectangleTextureSupport) { |
+ if (kGL_GrGLStandard == standard) { |
+ // "Conceptually, you can consider the declaration |
+ // #extension GL_ARB_texture_rectangle : require, to allow support |
+ // for texture rectangles, to be implicitly prepended to every |
+ // GLSL shader when ARB_texture_rectangle is advertised." |
+ // --> glslCaps->fRectangleTextureExtensionString == nullptr. |
+ glslCaps->fRectangleTextureUseUnifiedTextureFunctionName = |
+ ctxInfo.glslGeneration() >= k130_GrGLSLGeneration; |
+ } else { |
+ //"All future GLSL extensions should follow the "OpenGL Shading Language |
+ // Extension Conventions" however." |
+ // We imagine ANGLE implementation allowing ARB_texture_rectangle being |
+ // based on an extension text requires the extension string. |
+ glslCaps->fRectangleTextureExtensionString = "GL_ARB_texture_rectangle"; |
+ glslCaps->fRectangleTextureUseUnifiedTextureFunctionName = |
+ ctxInfo.glslGeneration() == k330_GrGLSLGeneration; |
+ } |
+ } |
// The Tegra3 compiler will sometimes never return if we have min(abs(x), 1.0), so we must do |
// the abs first in a separate expression. |