diff options
author | dongseong.hwang <dongseong.hwang@intel.com> | 2014-09-01 01:23:49 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-09-01 08:33:27 +0000 |
commit | 5d13a2b12e8cef22465edfd7113e002d257da117 (patch) | |
tree | 2552faf6a0f82fd37240b8982735a6015b488c89 /gpu | |
parent | dfce0f31d1bbf7d80f6c28ac44c27d15f34e4af0 (diff) | |
download | chromium_src-5d13a2b12e8cef22465edfd7113e002d257da117.zip chromium_src-5d13a2b12e8cef22465edfd7113e002d257da117.tar.gz chromium_src-5d13a2b12e8cef22465edfd7113e002d257da117.tar.bz2 |
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}
Diffstat (limited to 'gpu')
-rw-r--r-- | gpu/command_buffer/service/feature_info.cc | 24 | ||||
-rw-r--r-- | gpu/command_buffer/service/feature_info_unittest.cc | 19 |
2 files changed, 29 insertions, 14 deletions
diff --git a/gpu/command_buffer/service/feature_info.cc b/gpu/command_buffer/service/feature_info.cc index 968f2e4..3be7be0 100644 --- a/gpu/command_buffer/service/feature_info.cc +++ b/gpu/command_buffer/service/feature_info.cc @@ -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; diff --git a/gpu/command_buffer/service/feature_info_unittest.cc b/gpu/command_buffer/service/feature_info_unittest.cc index 6e2cb46..937dd1e 100644 --- a/gpu/command_buffer/service/feature_info_unittest.cc +++ b/gpu/command_buffer/service/feature_info_unittest.cc @@ -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()); } |