Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 if (internal_format_unsized && feature_info_->IsWebGL2OrES3Context()) { | |
| 13824 // The picks made by the temporary logic above may not be valid on ES3. | |
| 13825 DCHECK(type == GL_UNSIGNED_BYTE); | |
| 13826 switch (internal_format) { | |
| 13827 case GL_RGB: | |
| 13828 case GL_RGBA: | |
| 13829 case GL_LUMINANCE_ALPHA: | |
| 13830 case GL_LUMINANCE: | |
| 13831 case GL_ALPHA: | |
| 13832 case GL_BGRA_EXT: | |
| 13833 break; | |
| 13834 default: | |
| 13835 // Other unsized internal_formats are invalid in ES3. | |
|
Ken Russell (switch to Gerrit)
2016/11/10 23:32:30
Is this correct? ES spec 3.0.5, section 3.7, table
Ken Russell (switch to Gerrit)
2016/11/10 23:32:55
Also, please refer to this table in a comment.
Kai Ninomiya
2016/11/10 23:50:00
Done.
| |
| 13836 format = GL_NONE; | |
| 13837 break; | |
| 13838 } | |
| 13839 } | |
| 13822 if (!format || !type) { | 13840 if (!format || !type) { |
| 13823 LOCAL_SET_GL_ERROR( | 13841 LOCAL_SET_GL_ERROR( |
| 13824 GL_INVALID_OPERATION, | 13842 GL_INVALID_OPERATION, |
| 13825 func_name, "Invalid unsized internal format."); | 13843 func_name, "Invalid unsized internal format."); |
| 13826 return; | 13844 return; |
| 13827 } | 13845 } |
| 13828 | 13846 |
| 13829 DCHECK(texture_manager()->ValidateTextureParameters( | 13847 DCHECK(texture_manager()->ValidateTextureParameters( |
| 13830 GetErrorState(), func_name, true, format, type, internal_format, level)); | 13848 GetErrorState(), func_name, true, format, type, internal_format, level)); |
| 13831 | 13849 |
| (...skipping 4969 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 18801 } | 18819 } |
| 18802 | 18820 |
| 18803 // Include the auto-generated part of this file. We split this because it means | 18821 // 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 | 18822 // 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. | 18823 // instead of having to edit some template or the code generator. |
| 18806 #include "base/macros.h" | 18824 #include "base/macros.h" |
| 18807 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 18825 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
| 18808 | 18826 |
| 18809 } // namespace gles2 | 18827 } // namespace gles2 |
| 18810 } // namespace gpu | 18828 } // namespace gpu |
| OLD | NEW |