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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" 5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h"
6 6
7 #include <limits.h> 7 #include <limits.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 #include <stdio.h> 10 #include <stdio.h>
(...skipping 13801 matching lines...) Expand 10 before | Expand all | Expand 10 after
13812 return; 13812 return;
13813 } 13813 }
13814 13814
13815 uint32_t pixels_size = 0; 13815 uint32_t pixels_size = 0;
13816 // TODO(piman): OpenGL ES 3.0.4 Section 3.8.5 specifies how to pick an 13816 // TODO(piman): OpenGL ES 3.0.4 Section 3.8.5 specifies how to pick an
13817 // effective internal format if internal_format is unsized, which is a fairly 13817 // effective internal format if internal_format is unsized, which is a fairly
13818 // involved logic. For now, just make sure we pick something valid. 13818 // involved logic. For now, just make sure we pick something valid.
13819 GLenum format = 13819 GLenum format =
13820 TextureManager::ExtractFormatFromStorageFormat(internal_format); 13820 TextureManager::ExtractFormatFromStorageFormat(internal_format);
13821 GLenum type = TextureManager::ExtractTypeFromStorageFormat(internal_format); 13821 GLenum type = TextureManager::ExtractTypeFromStorageFormat(internal_format);
13822 bool internal_format_unsized = internal_format == format;
13823 // The picks made by the temporary logic above may not be valid on ES3.
13824 // This if-block checks the temporary logic and should be removed with it.
13825 if (internal_format_unsized && feature_info_->IsWebGL2OrES3Context()) {
13826 // While there are other possible types for unsized formats (cf. OpenGL ES
13827 // 3.0.5, section 3.7, table 3.3, page 113), they won't appear here.
13828 // ExtractTypeFromStorageFormat will always return UNSIGNED_BYTE for
13829 // unsized formats.
13830 DCHECK(type == GL_UNSIGNED_BYTE);
13831 switch (internal_format) {
13832 case GL_RGB:
13833 case GL_RGBA:
13834 case GL_LUMINANCE_ALPHA:
13835 case GL_LUMINANCE:
13836 case GL_ALPHA:
13837 case GL_BGRA_EXT:
13838 break;
13839 default:
13840 // Other unsized internal_formats are invalid in ES3.
13841 format = GL_NONE;
13842 break;
13843 }
13844 }
13822 if (!format || !type) { 13845 if (!format || !type) {
13823 LOCAL_SET_GL_ERROR( 13846 LOCAL_SET_GL_ERROR(
13824 GL_INVALID_OPERATION, 13847 GL_INVALID_OPERATION,
13825 func_name, "Invalid unsized internal format."); 13848 func_name, "Invalid unsized internal format.");
13826 return; 13849 return;
13827 } 13850 }
13828 13851
13829 DCHECK(texture_manager()->ValidateTextureParameters( 13852 DCHECK(texture_manager()->ValidateTextureParameters(
13830 GetErrorState(), func_name, true, format, type, internal_format, level)); 13853 GetErrorState(), func_name, true, format, type, internal_format, level));
13831 13854
(...skipping 4969 matching lines...) Expand 10 before | Expand all | Expand 10 after
18801 } 18824 }
18802 18825
18803 // Include the auto-generated part of this file. We split this because it means 18826 // Include the auto-generated part of this file. We split this because it means
18804 // we can easily edit the non-auto generated parts right here in this file 18827 // we can easily edit the non-auto generated parts right here in this file
18805 // instead of having to edit some template or the code generator. 18828 // instead of having to edit some template or the code generator.
18806 #include "base/macros.h" 18829 #include "base/macros.h"
18807 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 18830 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
18808 18831
18809 } // namespace gles2 18832 } // namespace gles2
18810 } // namespace gpu 18833 } // namespace gpu
OLDNEW
« 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