Commit 5d13a2b1 authored by dongseong.hwang's avatar dongseong.hwang Committed by Commit bot

gpu: Enable relevant extentions on GLES3.

What’s New in OpenGL ES 3.0 among GL extentions
- Vertex array
- Element index uint
- npot texture
- float texture (1)(2)
- GLSL standard derivatives
- Blend min&max

(1) GLES3 supports float and half float texture but only half float texture is
filterable and doesn't allow them for color attachment.
(2) This CL doesn't enable half_float due to conflicting GL_OES_texture_float

BUG=405484

Review URL: https://codereview.chromium.org/489023002

Cr-Commit-Position: refs/heads/master@{#292849}
parent dfce0f31
......@@ -228,8 +228,6 @@ void FeatureInfo::InitializeFeatures() {
StringSet extensions(
reinterpret_cast<const char*>(glGetString(GL_EXTENSIONS)));
bool npot_ok = false;
const char* renderer_str =
reinterpret_cast<const char*>(glGetString(GL_RENDERER));
if (renderer_str) {
......@@ -374,7 +372,7 @@ void FeatureInfo::InitializeFeatures() {
validators_.render_buffer_format.AddValue(GL_DEPTH24_STENCIL8);
}
if (extensions.Contains("GL_OES_vertex_array_object") ||
if (is_es3 || extensions.Contains("GL_OES_vertex_array_object") ||
extensions.Contains("GL_ARB_vertex_array_object") ||
extensions.Contains("GL_APPLE_vertex_array_object")) {
feature_flags_.native_vertex_array_object = true;
......@@ -387,7 +385,7 @@ void FeatureInfo::InitializeFeatures() {
feature_flags_.native_vertex_array_object = false;
}
if (extensions.Contains("GL_OES_element_index_uint") ||
if (is_es3 || extensions.Contains("GL_OES_element_index_uint") ||
gfx::HasDesktopGLFeatures()) {
AddExtensionString("GL_OES_element_index_uint");
validators_.index_type.AddValue(GL_UNSIGNED_INT);
......@@ -440,10 +438,10 @@ void FeatureInfo::InitializeFeatures() {
}
// Check if we should allow GL_OES_texture_npot
if (extensions.Contains("GL_ARB_texture_non_power_of_two") ||
if (is_es3 || extensions.Contains("GL_ARB_texture_non_power_of_two") ||
extensions.Contains("GL_OES_texture_npot")) {
AddExtensionString("GL_OES_texture_npot");
npot_ok = true;
feature_flags_.npot_ok = true;
}
// Check if we should allow GL_OES_texture_float, GL_OES_texture_half_float,
......@@ -462,7 +460,7 @@ void FeatureInfo::InitializeFeatures() {
enable_texture_half_float_linear = true;
may_enable_chromium_color_buffer_float = true;
} else {
if (extensions.Contains("GL_OES_texture_float")) {
if (is_es3 || extensions.Contains("GL_OES_texture_float")) {
enable_texture_float = true;
if (extensions.Contains("GL_OES_texture_float_linear")) {
enable_texture_float_linear = true;
......@@ -472,6 +470,8 @@ void FeatureInfo::InitializeFeatures() {
may_enable_chromium_color_buffer_float = true;
}
}
// TODO(dshwang): GLES3 supports half float by default but GL_HALF_FLOAT_OES
// isn't equal to GL_HALF_FLOAT.
if (extensions.Contains("GL_OES_texture_half_float")) {
enable_texture_half_float = true;
if (extensions.Contains("GL_OES_texture_half_float_linear")) {
......@@ -606,7 +606,7 @@ void FeatureInfo::InitializeFeatures() {
}
if (!workarounds_.disable_oes_standard_derivatives &&
(extensions.Contains("GL_OES_standard_derivatives") ||
(is_es3 || extensions.Contains("GL_OES_standard_derivatives") ||
gfx::HasDesktopGLFeatures())) {
AddExtensionString("GL_OES_standard_derivatives");
feature_flags_.oes_standard_derivatives = true;
......@@ -679,7 +679,6 @@ void FeatureInfo::InitializeFeatures() {
feature_flags_.enable_texture_float_linear |= enable_texture_float_linear;
feature_flags_.enable_texture_half_float_linear |=
enable_texture_half_float_linear;
feature_flags_.npot_ok |= npot_ok;
if (extensions.Contains("GL_ANGLE_pack_reverse_row_order")) {
AddExtensionString("GL_ANGLE_pack_reverse_row_order");
......@@ -774,6 +773,8 @@ void FeatureInfo::InitializeFeatures() {
++i) {
validators_.attachment.AddValue(i);
}
COMPILE_ASSERT(GL_COLOR_ATTACHMENT0_EXT == GL_COLOR_ATTACHMENT0,
color_attachment0_variation_must_match);
validators_.g_l_state.AddValue(GL_MAX_COLOR_ATTACHMENTS_EXT);
validators_.g_l_state.AddValue(GL_MAX_DRAW_BUFFERS_ARB);
......@@ -786,13 +787,16 @@ void FeatureInfo::InitializeFeatures() {
}
}
if (extensions.Contains("GL_EXT_blend_minmax") ||
if (is_es3 || extensions.Contains("GL_EXT_blend_minmax") ||
gfx::HasDesktopGLFeatures()) {
AddExtensionString("GL_EXT_blend_minmax");
validators_.equation.AddValue(GL_MIN_EXT);
validators_.equation.AddValue(GL_MAX_EXT);
COMPILE_ASSERT(GL_MIN_EXT == GL_MIN && GL_MAX_EXT == GL_MAX,
min_max_variations_must_match);
}
// TODO(dshwang): GLES3 supports gl_FragDepth, not gl_FragDepthEXT.
if (extensions.Contains("GL_EXT_frag_depth") || gfx::HasDesktopGLFeatures()) {
AddExtensionString("GL_EXT_frag_depth");
feature_flags_.ext_frag_depth = true;
......
......@@ -1170,18 +1170,23 @@ TEST_F(FeatureInfoTest, InitializeSamplersWithARBSamplerObjects) {
TEST_F(FeatureInfoTest, InitializeWithES3) {
SetupInitExpectationsWithGLVersion("", "", "OpenGL ES 3.0");
EXPECT_TRUE(info_->feature_flags().enable_samplers);
EXPECT_TRUE(info_->feature_flags().map_buffer_range);
EXPECT_TRUE(info_->feature_flags().ext_discard_framebuffer);
EXPECT_THAT(info_->extensions(), HasSubstr("GL_EXT_discard_framebuffer"));
EXPECT_TRUE(info_->feature_flags().chromium_framebuffer_multisample);
EXPECT_TRUE(info_->feature_flags().use_core_framebuffer_multisample);
EXPECT_THAT(info_->extensions(),
HasSubstr("GL_CHROMIUM_framebuffer_multisample"));
EXPECT_TRUE(info_->feature_flags().use_async_readpixels);
EXPECT_TRUE(info_->feature_flags().oes_standard_derivatives);
EXPECT_TRUE(info_->feature_flags().oes_depth24);
EXPECT_THAT(info_->extensions(), HasSubstr("GL_GOOGLE_depth_texture"));
EXPECT_THAT(info_->extensions(), HasSubstr("GL_CHROMIUM_depth_texture"));
EXPECT_TRUE(
info_->validators()->texture_internal_format.IsValid(GL_DEPTH_COMPONENT));
EXPECT_TRUE(
info_->validators()->texture_internal_format.IsValid(GL_DEPTH_STENCIL));
EXPECT_TRUE(info_->validators()->texture_format.IsValid(GL_DEPTH_COMPONENT));
EXPECT_TRUE(info_->validators()->texture_format.IsValid(GL_DEPTH_STENCIL));
EXPECT_TRUE(info_->validators()->pixel_type.IsValid(GL_UNSIGNED_SHORT));
EXPECT_TRUE(info_->validators()->pixel_type.IsValid(GL_UNSIGNED_INT));
EXPECT_TRUE(info_->validators()->pixel_type.IsValid(GL_UNSIGNED_INT_24_8));
EXPECT_TRUE(info_->GetTextureFormatValidator(GL_DEPTH_COMPONENT)
.IsValid(GL_UNSIGNED_SHORT));
......@@ -1198,6 +1203,12 @@ TEST_F(FeatureInfoTest, InitializeWithES3) {
EXPECT_TRUE(
info_->validators()->texture_internal_format.IsValid(GL_DEPTH_STENCIL));
EXPECT_TRUE(info_->validators()->texture_format.IsValid(GL_DEPTH_STENCIL));
EXPECT_TRUE(info_->feature_flags().npot_ok);
EXPECT_TRUE(info_->feature_flags().native_vertex_array_object);
EXPECT_TRUE(info_->feature_flags().enable_samplers);
EXPECT_TRUE(info_->feature_flags().map_buffer_range);
EXPECT_TRUE(info_->feature_flags().ext_discard_framebuffer);
EXPECT_THAT(info_->extensions(), HasSubstr("GL_EXT_discard_framebuffer"));
EXPECT_TRUE(info_->feature_flags().chromium_sync_query);
EXPECT_TRUE(gfx::GLFence::IsSupported());
}
......
......@@ -800,7 +800,7 @@ GL_FUNCTIONS = [
{ 'return_type': 'void',
'known_as': 'glGenVertexArraysOES',
'versions': [{ 'name': 'glGenVertexArrays',
'gl_versions': ['gl3', 'gl4'] },
'gl_versions': ['gl3', 'gl4', 'es3'] },
{ 'name': 'glGenVertexArrays',
'extensions': ['GL_ARB_vertex_array_object'] },
{ 'name': 'glGenVertexArraysOES' },
......@@ -810,7 +810,7 @@ GL_FUNCTIONS = [
{ 'return_type': 'void',
'known_as': 'glDeleteVertexArraysOES',
'versions': [{ 'name': 'glDeleteVertexArrays',
'gl_versions': ['gl3', 'gl4'] },
'gl_versions': ['gl3', 'gl4', 'es3'] },
{ 'name': 'glDeleteVertexArrays',
'extensions': ['GL_ARB_vertex_array_object'] },
{ 'name': 'glDeleteVertexArraysOES' },
......@@ -820,7 +820,7 @@ GL_FUNCTIONS = [
{ 'return_type': 'void',
'known_as': 'glBindVertexArrayOES',
'versions': [{ 'name': 'glBindVertexArray',
'gl_versions': ['gl3', 'gl4'] },
'gl_versions': ['gl3', 'gl4', 'es3'] },
{ 'name': 'glBindVertexArray',
'extensions': ['GL_ARB_vertex_array_object'] },
{ 'name': 'glBindVertexArrayOES' },
......
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