Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(690)

Unified Diff: gpu/command_buffer/service/gles2_cmd_decoder.cc

Issue 2146603005: Fix CopyTexImage2D when using unsized internal formats (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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,
« no previous file with comments | « no previous file | gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698