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

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

Issue 2485253005: CopyTexImage2D: don't pick invalid unsized internal formats on ES3 (Closed)
Patch Set: more detailed comments Created 4 years, 1 month 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 | no next file » | 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 1fce44cbb8d7ee858dc1d7faef634d6867c411bb..77d638b2314a05892cf37a6a85766106881744ee 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
@@ -13819,6 +13819,29 @@ void GLES2DecoderImpl::DoCopyTexImage2D(
GLenum format =
TextureManager::ExtractFormatFromStorageFormat(internal_format);
GLenum type = TextureManager::ExtractTypeFromStorageFormat(internal_format);
+ bool internal_format_unsized = internal_format == format;
+ // The picks made by the temporary logic above may not be valid on ES3.
+ // This if-block checks the temporary logic and should be removed with it.
+ if (internal_format_unsized && feature_info_->IsWebGL2OrES3Context()) {
+ // While there are other possible types for unsized formats (cf. OpenGL ES
+ // 3.0.5, section 3.7, table 3.3, page 113), they won't appear here.
+ // ExtractTypeFromStorageFormat will always return UNSIGNED_BYTE for
+ // unsized formats.
+ DCHECK(type == GL_UNSIGNED_BYTE);
+ switch (internal_format) {
+ case GL_RGB:
+ case GL_RGBA:
+ case GL_LUMINANCE_ALPHA:
+ case GL_LUMINANCE:
+ case GL_ALPHA:
+ case GL_BGRA_EXT:
+ break;
+ default:
+ // Other unsized internal_formats are invalid in ES3.
+ format = GL_NONE;
+ break;
+ }
+ }
if (!format || !type) {
LOCAL_SET_GL_ERROR(
GL_INVALID_OPERATION,
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698