Chromium Code Reviews| Index: gpu/command_buffer/service/feature_info.cc |
| diff --git a/gpu/command_buffer/service/feature_info.cc b/gpu/command_buffer/service/feature_info.cc |
| index 06ce1cef4294f85a4642eeb8d3bc751c37b3e05e..f5928328380a710cd81cd8a3c2c2e0021d12f25b 100644 |
| --- a/gpu/command_buffer/service/feature_info.cc |
| +++ b/gpu/command_buffer/service/feature_info.cc |
| @@ -651,7 +651,8 @@ void FeatureInfo::InitializeFeatures() { |
| // disable BGRA if we have to. |
| bool has_apple_bgra = extensions.Contains("GL_APPLE_texture_format_BGRA8888"); |
| bool has_ext_bgra = extensions.Contains("GL_EXT_texture_format_BGRA8888"); |
| - bool has_bgra = has_ext_bgra || has_apple_bgra || !gl_version_info_->is_es; |
| + bool enable_texture_format_bgra8888 = |
| + has_ext_bgra || has_apple_bgra || !gl_version_info_->is_es; |
| bool has_ext_texture_storage = extensions.Contains("GL_EXT_texture_storage"); |
| bool has_arb_texture_storage = extensions.Contains("GL_ARB_texture_storage"); |
| @@ -660,7 +661,6 @@ void FeatureInfo::InitializeFeatures() { |
| (has_ext_texture_storage || has_arb_texture_storage || |
| gl_version_info_->is_es3 || gl_version_info_->IsAtLeastGL(4, 2)); |
| - bool enable_texture_format_bgra8888 = has_bgra; |
| bool enable_texture_storage = has_texture_storage; |
| bool texture_storage_incompatible_with_bgra = |
| @@ -685,6 +685,17 @@ void FeatureInfo::InitializeFeatures() { |
| validators_.texture_internal_format.AddValue(GL_BGRA_EXT); |
| validators_.texture_format.AddValue(GL_BGRA_EXT); |
| validators_.texture_unsized_internal_format.AddValue(GL_BGRA_EXT); |
| + |
| + // GL_APPLE_texture_format_BGRA8888 explicitly declare GL_BGRA8_EXT is |
| + // added to internal format on ES3 context, but |
| + // GL_EXT_texture_format_BGRA8888 doesn't. |
| + if (gl_version_info_->is_es3 && has_apple_bgra) { |
| + validators_.texture_internal_format.AddValue(GL_BGRA8_EXT); |
| + validators_.texture_sized_color_renderable_internal_format.AddValue( |
| + GL_BGRA8_EXT); |
| + validators_.texture_sized_texture_filterable_internal_format.AddValue( |
| + GL_BGRA8_EXT); |
| + } |
| } |
| // On desktop, all devices support BGRA render buffers (note that on desktop |
| @@ -1104,8 +1115,20 @@ void FeatureInfo::InitializeFeatures() { |
| feature_flags_.ext_texture_storage = true; |
| AddExtensionString("GL_EXT_texture_storage"); |
| validators_.texture_parameter.AddValue(GL_TEXTURE_IMMUTABLE_FORMAT_EXT); |
| - if (enable_texture_format_bgra8888) |
| - validators_.texture_internal_format_storage.AddValue(GL_BGRA8_EXT); |
| + if (enable_texture_format_bgra8888) { |
| + validators_.texture_internal_format_storage.AddValue(GL_BGRA8_EXT); |
| + // GL_APPLE_texture_format_BGRA8888 can add it above. |
| + if (!validators_.texture_sized_color_renderable_internal_format.IsValid( |
|
Zhenyao Mo
2016/10/10 20:30:29
I am not sure I follow the logic of this block. t
dshwang
2016/10/10 20:57:10
Sorry for insufficient explanation.
|texture_sized
Zhenyao Mo
2016/10/10 21:00:27
But this also enables TexImage calls to use these
dshwang
2016/10/10 21:18:29
Oh, I didn't know.
Even if EXT_texture_format_BGR
|
| + GL_BGRA8_EXT)) { |
| + validators_.texture_sized_color_renderable_internal_format.AddValue( |
| + GL_BGRA8_EXT); |
| + } |
| + if (!validators_.texture_sized_texture_filterable_internal_format.IsValid( |
| + GL_BGRA8_EXT)) { |
| + validators_.texture_sized_texture_filterable_internal_format.AddValue( |
| + GL_BGRA8_EXT); |
| + } |
| + } |
| if (enable_texture_float) { |
| validators_.texture_internal_format_storage.AddValue(GL_RGBA32F_EXT); |
| validators_.texture_internal_format_storage.AddValue(GL_RGB32F_EXT); |