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 3e568e3c5ed7e3ce11285591512433a31326867b..bb3038ee63178ef24fcee4e7b9068a71fd5bd1eb 100644 |
| --- a/gpu/command_buffer/service/gles2_cmd_decoder.cc |
| +++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc |
| @@ -9105,6 +9105,16 @@ void GLES2DecoderImpl::DoCopyTexImage2D( |
| GLsizei height, |
| GLint border) { |
| DCHECK(!ShouldDeferReads()); |
| + uint32 channels_needed = GLES2Util::GetChannelsForFormat(internal_format); |
| + // We need to reject DEPTH or STENCIL internal formats here because it shares |
| + // the same validator as TexImage*D's internal format, where such formats are |
| + // supported. |
| + if ((channels_needed & (GLES2Util::kDepth | GLES2Util::kStencil)) != 0) { |
| + LOCAL_SET_GL_ERROR( |
| + GL_INVALID_ENUM, |
|
Zhenyao Mo
2015/03/12 22:16:38
This is correct because such format is not one of
|
| + "glCopyImage2D", "invalid internal format"); |
| + return; |
| + } |
| TextureRef* texture_ref = texture_manager()->GetTextureInfoForTarget( |
| &state_, target); |
| if (!texture_ref) { |
| @@ -9134,7 +9144,6 @@ void GLES2DecoderImpl::DoCopyTexImage2D( |
| // Check we have compatible formats. |
| GLenum read_format = GetBoundReadFrameBufferInternalFormat(); |
| uint32 channels_exist = GLES2Util::GetChannelsForFormat(read_format); |
| - uint32 channels_needed = GLES2Util::GetChannelsForFormat(internal_format); |
| if ((channels_needed & channels_exist) != channels_needed) { |
| LOCAL_SET_GL_ERROR( |
| @@ -9142,13 +9151,6 @@ void GLES2DecoderImpl::DoCopyTexImage2D( |
| return; |
| } |
| - if ((channels_needed & (GLES2Util::kDepth | GLES2Util::kStencil)) != 0) { |
| - LOCAL_SET_GL_ERROR( |
| - GL_INVALID_OPERATION, |
| - "glCopyTexImage2D", "can not be used with depth or stencil textures"); |
| - return; |
| - } |
| - |
| uint32 estimated_size = 0; |
| if (!GLES2Util::ComputeImageDataSizes( |
| width, height, 1, internal_format, GL_UNSIGNED_BYTE, |