Commit 90d1ff67 authored by Geoff Lang's avatar Geoff Lang Committed by Commit Bot

Always request extensions that are emulated or used internally by the command buffer.

As ANGLE makes more extensions enableable (and disabled by default for
WebGL contexts), they need to be requested by the passthrough command
decoder in order to maintain the same functionality.  Eventually these
extensions can be requested from WebGL once the command buffer client is
aware of the functionality.

BUG=angleproject:1523

Cq-Include-Trybots: master.tryserver.chromium.android:android_optional_gpu_tests_rel;master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel
Change-Id: I91194b32efc7df0fe340dcd5f52e4fc1dcd59e62
Reviewed-on: https://chromium-review.googlesource.com/687534
Commit-Queue: Geoff Lang <geofflang@chromium.org>
Reviewed-by: default avatarAntoine Labour <piman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#504837}
parent fc3bc4d9
......@@ -561,6 +561,60 @@ bool GLES2DecoderPassthroughImpl::Initialize(
return false;
}
// Extensions that are enabled via emulation on the client side or needed for
// basic command buffer functionality. Make sure they are always enabled.
if (IsWebGLContextType(attrib_helper.context_type)) {
static constexpr const char* kEnableByDefaultExtensions[] = {
"GL_ANGLE_depth_texture",
"GL_ANGLE_framebuffer_blit",
"GL_ANGLE_framebuffer_multisample",
"GL_ANGLE_instanced_arrays",
"GL_ANGLE_pack_reverse_row_order",
"GL_ANGLE_texture_compression_dxt3",
"GL_ANGLE_texture_compression_dxt5",
"GL_ANGLE_texture_usage",
"GL_ANGLE_translated_shader_source",
"GL_CHROMIUM_bind_uniform_location",
"GL_CHROMIUM_framebuffer_mixed_samples",
"GL_CHROMIUM_path_rendering",
"GL_CHROMIUM_sync_query",
"GL_EXT_blend_minmax",
"GL_EXT_debug_marker",
"GL_EXT_discard_framebuffer",
"GL_EXT_disjoint_timer_query",
"GL_EXT_occlusion_query_boolean",
"GL_EXT_sRGB",
"GL_EXT_sRGB_write_control",
"GL_EXT_texture_compression_dxt1",
"GL_EXT_texture_compression_s3tc_srgb",
"GL_EXT_texture_norm16",
"GL_EXT_texture_rg",
"GL_EXT_texture_sRGB_decode",
"GL_EXT_texture_storage",
"GL_EXT_unpack_subimage",
"GL_KHR_texture_compression_astc_hdr",
"GL_KHR_texture_compression_astc_ldr",
"GL_NV_fence",
"GL_NV_pack_subimage",
"GL_OES_compressed_ETC1_RGB8_texture",
"GL_OES_depth32",
"GL_OES_fbo_render_mipmap",
"GL_OES_packed_depth_stencil",
"GL_OES_rgb8_rgba8",
"GL_OES_vertex_array_object",
};
// Grab the extensions that are requestable
gl::ExtensionSet requestable_extensions(
gl::GetRequestableGLExtensionsFromCurrentContext());
for (const char* default_extension : kEnableByDefaultExtensions) {
if (gl::HasExtension(requestable_extensions, default_extension)) {
// Request the intersection of the two sets
glRequestExtensionANGLE(default_extension);
}
}
}
// Each context initializes its own feature info because some extensions may
// be enabled dynamically. Don't disallow any features, leave it up to ANGLE
// to dynamically enable extensions.
......
......@@ -55,6 +55,28 @@ void CleanupNativeLibraries(void* unused) {
}
}
ExtensionSet GetGLExtensionsFromCurrentContext(GLApi* api,
GLenum extensions_enum,
GLenum num_extensions_enum) {
if (WillUseGLGetStringForExtensions(api)) {
const char* extensions =
reinterpret_cast<const char*>(api->glGetStringFn(extensions_enum));
return extensions ? MakeExtensionSet(extensions) : ExtensionSet();
}
GLint num_extensions = 0;
api->glGetIntegervFn(num_extensions_enum, &num_extensions);
std::vector<base::StringPiece> exts(num_extensions);
for (GLint i = 0; i < num_extensions; ++i) {
const char* extension =
reinterpret_cast<const char*>(api->glGetStringiFn(extensions_enum, i));
DCHECK(extension != NULL);
exts[i] = extension;
}
return ExtensionSet(exts);
}
} // namespace
base::ThreadLocalPointer<CurrentGL>* g_current_gl_context_tls = NULL;
......@@ -215,6 +237,15 @@ std::string GetGLExtensionsFromCurrentContext(GLApi* api) {
return base::JoinString(exts, " ");
}
ExtensionSet GetRequestableGLExtensionsFromCurrentContext() {
return GetRequestableGLExtensionsFromCurrentContext(g_current_gl_context);
}
ExtensionSet GetRequestableGLExtensionsFromCurrentContext(GLApi* api) {
return GetGLExtensionsFromCurrentContext(api, GL_REQUESTABLE_EXTENSIONS_ANGLE,
GL_NUM_REQUESTABLE_EXTENSIONS_ANGLE);
}
bool WillUseGLGetStringForExtensions() {
return WillUseGLGetStringForExtensions(g_current_gl_context);
}
......
......@@ -12,6 +12,7 @@
#include "base/files/file_path.h"
#include "base/native_library.h"
#include "build/build_config.h"
#include "ui/gl/extension_set.h"
#include "ui/gl/gl_export.h"
#include "ui/gl/gl_switches.h"
......@@ -119,6 +120,9 @@ GL_EXPORT GLFunctionPointerType GetGLProcAddress(const char* name);
GL_EXPORT std::string GetGLExtensionsFromCurrentContext();
GL_EXPORT std::string GetGLExtensionsFromCurrentContext(GLApi* api);
GL_EXPORT ExtensionSet GetRequestableGLExtensionsFromCurrentContext();
GL_EXPORT ExtensionSet GetRequestableGLExtensionsFromCurrentContext(GLApi* api);
// Helper for the GL bindings implementation to understand whether
// glGetString(GL_EXTENSIONS) or glGetStringi(GL_EXTENSIONS, i) will
// be used in the function above.
......
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