diff --git a/gpu/GLES2/extensions/CHROMIUM/CHROMIUM_ycbcr_422_image.txt b/gpu/GLES2/extensions/CHROMIUM/CHROMIUM_ycbcr_422_image.txt new file mode 100644 index 0000000000000..546d783976d4c --- /dev/null +++ b/gpu/GLES2/extensions/CHROMIUM/CHROMIUM_ycbcr_422_image.txt @@ -0,0 +1,48 @@ +Name + + CHROMIUM_ycbcr_422_image + +Name Strings + + GL_CHROMIUM_ycbcr_422_image + +Version + + Last Modifed Date: August 26, 2015 + +Dependencies + + OpenGL ES 2.0 is required. + + GL_CHROMIUM_image is required. + +Overview + + This extension provides a new internal image format to use when creating an + image from underlying '2vuy' buffers. + + This extension is useful in conjunction with CreateImageCHROMIUM and + CreateGpuMemoryBufferImageCHROMIUM to define the format of GpuMemoryBuffer + backing the image. + +New Procedures and Functions + + None. + +Errors + + None. + +New Tokens + + Accepted by the parameter of CreateImageCHROMIUM, and + parameter of CreateGpuMemoryBufferImageCHROMIUM: + GL_RGB_YCBCR_422_CHROMIUM 0x78FB + +New State + + None. + +Revision History + + 8/26/2015 Documented the extension diff --git a/gpu/GLES2/gl2extchromium.h b/gpu/GLES2/gl2extchromium.h index 584d29a267d96..77f0d9fb31805 100644 --- a/gpu/GLES2/gl2extchromium.h +++ b/gpu/GLES2/gl2extchromium.h @@ -140,6 +140,10 @@ typedef void ( #define GL_RGB_YUV_420_CHROMIUM 0x78FA #endif +#ifndef GL_RGB_YCBCR_422_CHROMIUM +#define GL_RGB_YCBCR_422_CHROMIUM 0x78FB +#endif + #ifdef GL_GLEXT_PROTOTYPES GL_APICALL GLuint GL_APIENTRY glCreateGpuMemoryBufferImageCHROMIUM( GLsizei width, diff --git a/gpu/command_buffer/build_gles2_cmd_buffer.py b/gpu/command_buffer/build_gles2_cmd_buffer.py index 7962955229341..f23f79b5e92e2 100755 --- a/gpu/command_buffer/build_gles2_cmd_buffer.py +++ b/gpu/command_buffer/build_gles2_cmd_buffer.py @@ -1862,6 +1862,7 @@ 'valid': [ 'GL_RGB', 'GL_RGB_YUV_420_CHROMIUM', + 'GL_RGB_YCBCR_422_CHROMIUM', 'GL_RGBA', ], }, diff --git a/gpu/command_buffer/common/capabilities.cc b/gpu/command_buffer/common/capabilities.cc index d0ac492fde03b..e677b143324fb 100644 --- a/gpu/command_buffer/common/capabilities.cc +++ b/gpu/command_buffer/common/capabilities.cc @@ -73,11 +73,11 @@ Capabilities::Capabilities() blend_equation_advanced(false), blend_equation_advanced_coherent(false), texture_rg(false), + image_ycbcr_422(false), render_buffer_format_bgra8888(false), occlusion_query_boolean(false), surfaceless(false), major_version(2), - minor_version(0) { -} + minor_version(0) {} } // namespace gpu diff --git a/gpu/command_buffer/common/capabilities.h b/gpu/command_buffer/common/capabilities.h index dd08875299475..17b6cfe5d9623 100644 --- a/gpu/command_buffer/common/capabilities.h +++ b/gpu/command_buffer/common/capabilities.h @@ -132,6 +132,7 @@ struct GPU_EXPORT Capabilities { bool blend_equation_advanced; bool blend_equation_advanced_coherent; bool texture_rg; + bool image_ycbcr_422; bool render_buffer_format_bgra8888; bool occlusion_query_boolean; bool timer_queries; diff --git a/gpu/command_buffer/common/gles2_cmd_utils_implementation_autogen.h b/gpu/command_buffer/common/gles2_cmd_utils_implementation_autogen.h index 0196461dc5af4..138a8896df963 100644 --- a/gpu/command_buffer/common/gles2_cmd_utils_implementation_autogen.h +++ b/gpu/command_buffer/common/gles2_cmd_utils_implementation_autogen.h @@ -252,6 +252,9 @@ static const GLES2Util::EnumToString enum_to_string_table[] = { { 0x8A53, "GL_SYNC_OBJECT_APPLE", }, + { + 0x78FB, "GL_RGB_YCBCR_422_CHROMIUM", + }, { 0x8DF8, "GL_SHADER_BINARY_FORMATS", }, @@ -3919,6 +3922,7 @@ std::string GLES2Util::GetStringImageInternalFormat(uint32_t value) { static const EnumToString string_table[] = { {GL_RGB, "GL_RGB"}, {GL_RGB_YUV_420_CHROMIUM, "GL_RGB_YUV_420_CHROMIUM"}, + {GL_RGB_YCBCR_422_CHROMIUM, "GL_RGB_YCBCR_422_CHROMIUM"}, {GL_RGBA, "GL_RGBA"}, }; return GLES2Util::GetQualifiedEnumString(string_table, diff --git a/gpu/command_buffer/service/feature_info.cc b/gpu/command_buffer/service/feature_info.cc index b1e92e6e4c598..02b58354ba473 100644 --- a/gpu/command_buffer/service/feature_info.cc +++ b/gpu/command_buffer/service/feature_info.cc @@ -167,10 +167,10 @@ FeatureInfo::FeatureFlags::FeatureFlags() blend_equation_advanced(false), blend_equation_advanced_coherent(false), ext_texture_rg(false), + chromium_image_ycbcr_422(false), enable_subscribe_uniform(false), emulate_primitive_restart_fixed_index(false), - ext_render_buffer_format_bgra8888(false) { -} + ext_render_buffer_format_bgra8888(false) {} FeatureInfo::Workarounds::Workarounds() : #define GPU_OP(type, name) name(false), @@ -790,6 +790,11 @@ void FeatureInfo::InitializeFeatures() { AddExtensionString("GL_CHROMIUM_iosurface"); #endif + if (extensions.Contains("GL_APPLE_ycbcr_422")) { + AddExtensionString("GL_CHROMIUM_ycbcr_422_image"); + feature_flags_.chromium_image_ycbcr_422 = true; + } + // TODO(gman): Add support for these extensions. // GL_OES_depth32 diff --git a/gpu/command_buffer/service/feature_info.h b/gpu/command_buffer/service/feature_info.h index 4a55c958fe468..3970b2f673aa7 100644 --- a/gpu/command_buffer/service/feature_info.h +++ b/gpu/command_buffer/service/feature_info.h @@ -79,6 +79,7 @@ class GPU_EXPORT FeatureInfo : public base::RefCounted { bool blend_equation_advanced; bool blend_equation_advanced_coherent; bool ext_texture_rg; + bool chromium_image_ycbcr_422; bool enable_subscribe_uniform; bool emulate_primitive_restart_fixed_index; bool ext_render_buffer_format_bgra8888; diff --git a/gpu/command_buffer/service/feature_info_unittest.cc b/gpu/command_buffer/service/feature_info_unittest.cc index be78a0448fd75..47a1999879fd5 100644 --- a/gpu/command_buffer/service/feature_info_unittest.cc +++ b/gpu/command_buffer/service/feature_info_unittest.cc @@ -293,6 +293,7 @@ TEST_P(FeatureInfoTest, InitializeNoExtensions) { GL_SRGB8_ALPHA8_EXT)); EXPECT_FALSE(info_->validators()->frame_buffer_parameter.IsValid( GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT)); + EXPECT_FALSE(info_->feature_flags().chromium_image_ycbcr_422); } TEST_P(FeatureInfoTest, InitializeWithANGLE) { @@ -1363,5 +1364,10 @@ TEST_P(FeatureInfoTest, InitializeARB_texture_rgNoFloat) { EXPECT_TRUE(info_->validators()->render_buffer_format.IsValid(GL_RG8_EXT)); } +TEST_P(FeatureInfoTest, InitializeCHROMIUM_ycbcr_422_imageTrue) { + SetupInitExpectations("GL_APPLE_ycbcr_422"); + EXPECT_TRUE(info_->feature_flags().chromium_image_ycbcr_422); +} + } // namespace gles2 } // namespace gpu diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc index 82e9052c63b7c..80367724bbada 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder.cc +++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc @@ -3198,6 +3198,8 @@ Capabilities GLES2DecoderImpl::GetCapabilities() { caps.blend_equation_advanced_coherent = feature_info_->feature_flags().blend_equation_advanced_coherent; caps.texture_rg = feature_info_->feature_flags().ext_texture_rg; + caps.image_ycbcr_422 = + feature_info_->feature_flags().chromium_image_ycbcr_422; caps.max_copy_texture_chromium_size = feature_info_->workarounds().max_copy_texture_chromium_size; caps.render_buffer_format_bgra8888 = diff --git a/gpu/command_buffer/service/gles2_cmd_validation_implementation_autogen.h b/gpu/command_buffer/service/gles2_cmd_validation_implementation_autogen.h index 958e67a06a94b..bd1605ddfd597 100644 --- a/gpu/command_buffer/service/gles2_cmd_validation_implementation_autogen.h +++ b/gpu/command_buffer/service/gles2_cmd_validation_implementation_autogen.h @@ -363,7 +363,7 @@ static const GLenum valid_hint_target_table_es3[] = { }; static const GLenum valid_image_internal_format_table[] = { - GL_RGB, GL_RGB_YUV_420_CHROMIUM, GL_RGBA, + GL_RGB, GL_RGB_YUV_420_CHROMIUM, GL_RGB_YCBCR_422_CHROMIUM, GL_RGBA, }; static const GLenum valid_image_usage_table[] = { diff --git a/gpu/command_buffer/tests/gl_unittest.cc b/gpu/command_buffer/tests/gl_unittest.cc index 1df56c0756e33..165d3b1db4cf8 100644 --- a/gpu/command_buffer/tests/gl_unittest.cc +++ b/gpu/command_buffer/tests/gl_unittest.cc @@ -106,6 +106,7 @@ TEST_F(GLTest, FeatureFlagsMatchCapabilities) { EXPECT_EQ(caps.blend_equation_advanced_coherent, flags.blend_equation_advanced_coherent); EXPECT_EQ(caps.texture_rg, flags.ext_texture_rg); + EXPECT_EQ(caps.image_ycbcr_422, flags.chromium_image_ycbcr_422); EXPECT_EQ(caps.render_buffer_format_bgra8888, flags.ext_render_buffer_format_bgra8888); EXPECT_EQ(caps.occlusion_query_boolean, flags.occlusion_query_boolean); diff --git a/ui/gl/gl_bindings.h b/ui/gl/gl_bindings.h index 983ba7f31c157..cbd224aeace93 100644 --- a/ui/gl/gl_bindings.h +++ b/ui/gl/gl_bindings.h @@ -139,6 +139,9 @@ // GL_CHROMIUM_yuv_420_image #define GL_RGB_YUV_420_CHROMIUM 0x78FA +// GL_CHROMIUM_ycbcr_422_image +#define GL_RGB_YCBCR_422_CHROMIUM 0x78FB + // GL_CHROMIUM_schedule_overlay_plane #define GL_OVERLAY_TRANSFORM_NONE_CHROMIUM 0x9245 #define GL_OVERLAY_TRANSFORM_FLIP_HORIZONTAL_CHROMIUM 0x9246