| 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 3ccb1c4ecfa9d4fffa49342ec329c0c8150276b2..eecf5a2155fcbcf20b85167678816c728bf4d713 100644
|
| --- a/gpu/command_buffer/service/gles2_cmd_decoder.cc
|
| +++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
|
| @@ -12664,9 +12664,22 @@ void GLES2DecoderImpl::DoCopyTexImage2D(
|
| }
|
|
|
| uint32_t pixels_size = 0;
|
| - GLenum format = TextureManager::ExtractFormatFromStorageFormat(
|
| - internal_format);
|
| + // TODO(piman): OpenGL ES 3.0.4 Section 3.8.5 specifies how to pick an
|
| + // effective internal format if internal_format is unsized, which is a fairly
|
| + // involved logic. For now, just make sure we pick something valid.
|
| + GLenum format =
|
| + TextureManager::ExtractFormatFromStorageFormat(internal_format);
|
| GLenum type = TextureManager::ExtractTypeFromStorageFormat(internal_format);
|
| + if (!format || !type) {
|
| + LOCAL_SET_GL_ERROR(
|
| + GL_INVALID_OPERATION,
|
| + func_name, "Invalid unsized internal format.");
|
| + return;
|
| + }
|
| +
|
| + DCHECK(texture_manager()->ValidateTextureParameters(
|
| + GetErrorState(), func_name, true, format, type, internal_format, level));
|
| +
|
| // Only target image size is validated here.
|
| if (!GLES2Util::ComputeImageDataSizes(
|
| width, height, 1, format, type,
|
|
|