Commit 729a9c97 by Corentin Wallez Committed by Commit Bot

Don't require GL_ARB_gpu_shader5 in order to support ES 3.0.

ES 3.0 doesn't require non-constant sampler array indexing, and we can't require it for ES 2 without breaking WebGL for some users. BUG=671280 Change-Id: Ib04446284acc92410a90c683a3d222871de554a8 Reviewed-on: https://chromium-review.googlesource.com/416195 Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: 's avatarKenneth Russell <kbr@chromium.org>
parent a20fc005
...@@ -259,20 +259,14 @@ void TranslatorGLSL::writeExtensionBehavior(TIntermNode *root) ...@@ -259,20 +259,14 @@ void TranslatorGLSL::writeExtensionBehavior(TIntermNode *root)
} }
// Need to enable gpu_shader5 to have index constant sampler array indexing // Need to enable gpu_shader5 to have index constant sampler array indexing
if (getOutputType() != SH_ESSL_OUTPUT && getOutputType() < SH_GLSL_400_CORE_OUTPUT) if (getOutputType() != SH_ESSL_OUTPUT && getOutputType() < SH_GLSL_400_CORE_OUTPUT &&
getShaderVersion() == 100)
{ {
sink << "#extension GL_ARB_gpu_shader5 : "; // Don't use "require" on to avoid breaking WebGL 1 on drivers that silently
// support index constant sampler array indexing, but don't have the extension or
// Don't use "require" on WebGL 1 to avoid breaking WebGL on drivers that silently // on drivers that don't have the extension at all as it would break WebGL 1 for
// support index constant sampler array indexing, but don't have the extension. // some users.
if (getShaderVersion() >= 300) sink << "#extension GL_ARB_gpu_shader5 : enable\n";
{
sink << "require\n";
}
else
{
sink << "enable\n";
}
} }
TExtensionGLSL extensionGLSL(getOutputType()); TExtensionGLSL extensionGLSL(getOutputType());
......
...@@ -549,16 +549,11 @@ void GenerateCaps(const FunctionsGL *functions, gl::Caps *caps, gl::TextureCapsM ...@@ -549,16 +549,11 @@ void GenerateCaps(const FunctionsGL *functions, gl::Caps *caps, gl::TextureCapsM
LimitVersion(maxSupportedESVersion, gl::Version(2, 0)); LimitVersion(maxSupportedESVersion, gl::Version(2, 0));
} }
// Check if index constant sampler array indexing is supported // Non-constant sampler array indexing is required for OpenGL ES 2 and OpenGL ES after 3.2.
if (!functions->isAtLeastGL(gl::Version(4, 0)) && // However having it available on OpenGL ES 2 is a specification bug, and using this
!functions->isAtLeastGLES(gl::Version(2, 0)) && // indexing in WebGL is undefined. Requiring this feature would break WebGL 1 for some users
!functions->hasExtension("GL_ARB_gpu_shader5")) // so we don't check for it. (it is present with ESSL 100, ESSL >= 320, GLSL >= 400 and
{ // GL_ARB_gpu_shader5)
// This should also be required for ES2 but there are some driver support index constant
// sampler array indexing without meeting the requirements above. Don't limit their ES
// version as it would break WebGL for some users.
LimitVersion(maxSupportedESVersion, gl::Version(2, 0));
}
// Check if sampler objects are supported // Check if sampler objects are supported
if (!functions->isAtLeastGL(gl::Version(3, 3)) && if (!functions->isAtLeastGL(gl::Version(3, 3)) &&
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment