Chromium Code Reviews| Index: gpu/command_buffer/service/gles2_cmd_decoder.cc |
| diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc |
| index c9e8470b6cca2e031b61a22bbd12e737b48a5c55..de035ddd4b176b9d64e693f639b939d37a75dd89 100644 |
| --- a/gpu/command_buffer/service/gles2_cmd_decoder.cc |
| +++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc |
| @@ -11442,6 +11442,24 @@ error::Error GLES2DecoderImpl::HandleTexImage2D(uint32_t immediate_data_size, |
| // service side. |
| params.alignment = state_.unpack_alignment; |
| } |
| + |
| + // When the client is providing ES 2.0 or WebGL 1.0 contexts, but the |
| + // command buffer is running on top of desktop GL or ES 3.0, it would |
| + // have to translate these unsized internal formats to the appropriate |
| + // sized internal formats. |
| + if ((internal_format == GL_SRGB_EXT || |
| + internal_format == GL_SRGB_ALPHA_EXT) && |
| + (feature_info_->context_type() == CONTEXT_TYPE_WEBGL2 || |
| + feature_info_->context_type() == CONTEXT_TYPE_OPENGLES3)) { |
|
Zhenyao Mo
2016/04/27 17:12:26
I just realized we have a different place for such
xinghua.cao
2016/04/28 09:59:27
I have put this mapping in gl_gl_api_implementatio
|
| + if (internal_format == GL_SRGB_EXT) { |
| + internal_format = GL_SRGB8; |
| + format = GL_RGB; |
| + } else if (internal_format == GL_SRGB_ALPHA_EXT) { |
| + internal_format = GL_SRGB8_ALPHA8; |
| + format = GL_RGBA; |
| + } |
| + } |
| + |
| uint32_t pixels_size; |
| uint32_t skip_size; |
| uint32_t padding; |
| @@ -12008,6 +12026,21 @@ error::Error GLES2DecoderImpl::HandleTexSubImage2D(uint32_t immediate_data_size, |
| // service side. |
| params.alignment = state_.unpack_alignment; |
| } |
| + |
| + // When the client is providing ES 2.0 or WebGL 1.0 contexts, but the |
| + // command buffer is running on top of desktop GL or ES 3.0, it would |
| + // have to translate these unsized internal formats to the appropriate |
| + // sized internal formats. |
| + if ((format == GL_SRGB_EXT || format == GL_SRGB_ALPHA_EXT) && |
|
Zhenyao Mo
2016/04/27 17:12:26
Same here. Let's do the mapping in ui/gl/gl_gl_api
|
| + (feature_info_->context_type() == CONTEXT_TYPE_WEBGL2 || |
| + feature_info_->context_type() == CONTEXT_TYPE_OPENGLES3)) { |
| + if (format == GL_SRGB_EXT) { |
| + format = GL_RGB; |
| + } else if (format == GL_SRGB_ALPHA_EXT) { |
| + format = GL_RGBA; |
| + } |
| + } |
| + |
| uint32_t pixels_size; |
| uint32_t skip_size; |
| uint32_t padding; |