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

Side by Side Diff: gpu/command_buffer/service/gles2_cmd_decoder.cc

Issue 2548733002: Set correct internalformat info for TexStorageEXT for WebGL1 context (Closed)
Patch Set: add unittests Created 4 years 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 | gpu/command_buffer/service/gles2_cmd_decoder_unittest_textures.cc » ('j') | 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 16729 matching lines...) Expand 10 before | Expand all | Expand 10 after
16740 } 16740 }
16741 if (workarounds().reset_base_mipmap_level_before_texstorage && 16741 if (workarounds().reset_base_mipmap_level_before_texstorage &&
16742 texture->base_level() > 0) 16742 texture->base_level() > 0)
16743 glTexParameteri(target, GL_TEXTURE_BASE_LEVEL, texture->base_level()); 16743 glTexParameteri(target, GL_TEXTURE_BASE_LEVEL, texture->base_level());
16744 16744
16745 { 16745 {
16746 GLsizei level_width = width; 16746 GLsizei level_width = width;
16747 GLsizei level_height = height; 16747 GLsizei level_height = height;
16748 GLsizei level_depth = depth; 16748 GLsizei level_depth = depth;
16749 16749
16750 GLenum adjusted_internal_format = 16750 const bool is_es2 =
16751 feature_info_->context_type() == CONTEXT_TYPE_OPENGLES2 ? 16751 feature_info_->context_type() == CONTEXT_TYPE_OPENGLES2 ||
16752 format : internal_format; 16752 feature_info_->context_type() == CONTEXT_TYPE_WEBGL1;
qiankun 2016/12/02 10:10:38 You can use feature_info_->IsWebGL1OrES2Context()
dshwang 2016/12/02 17:54:20 Good point! Done.
16753 GLenum adjusted_internal_format = is_es2 ? format : internal_format;
16753 for (int ii = 0; ii < levels; ++ii) { 16754 for (int ii = 0; ii < levels; ++ii) {
16754 if (target == GL_TEXTURE_CUBE_MAP) { 16755 if (target == GL_TEXTURE_CUBE_MAP) {
16755 for (int jj = 0; jj < 6; ++jj) { 16756 for (int jj = 0; jj < 6; ++jj) {
16756 GLenum face = GL_TEXTURE_CUBE_MAP_POSITIVE_X + jj; 16757 GLenum face = GL_TEXTURE_CUBE_MAP_POSITIVE_X + jj;
16757 texture_manager()->SetLevelInfo( 16758 texture_manager()->SetLevelInfo(
16758 texture_ref, face, ii, adjusted_internal_format, level_width, 16759 texture_ref, face, ii, adjusted_internal_format, level_width,
16759 level_height, 1, 0, format, type, gfx::Rect()); 16760 level_height, 1, 0, format, type, gfx::Rect());
16760 } 16761 }
16761 } else { 16762 } else {
16762 texture_manager()->SetLevelInfo( 16763 texture_manager()->SetLevelInfo(
(...skipping 2109 matching lines...) Expand 10 before | Expand all | Expand 10 after
18872 } 18873 }
18873 18874
18874 // Include the auto-generated part of this file. We split this because it means 18875 // Include the auto-generated part of this file. We split this because it means
18875 // we can easily edit the non-auto generated parts right here in this file 18876 // we can easily edit the non-auto generated parts right here in this file
18876 // instead of having to edit some template or the code generator. 18877 // instead of having to edit some template or the code generator.
18877 #include "base/macros.h" 18878 #include "base/macros.h"
18878 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 18879 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
18879 18880
18880 } // namespace gles2 18881 } // namespace gles2
18881 } // namespace gpu 18882 } // namespace gpu
OLDNEW
« no previous file with comments | « no previous file | gpu/command_buffer/service/gles2_cmd_decoder_unittest_textures.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698