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 16658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
16669 } | 16669 } |
16670 if (workarounds().reset_base_mipmap_level_before_texstorage && | 16670 if (workarounds().reset_base_mipmap_level_before_texstorage && |
16671 texture->base_level() > 0) | 16671 texture->base_level() > 0) |
16672 glTexParameteri(target, GL_TEXTURE_BASE_LEVEL, texture->base_level()); | 16672 glTexParameteri(target, GL_TEXTURE_BASE_LEVEL, texture->base_level()); |
16673 | 16673 |
16674 { | 16674 { |
16675 GLsizei level_width = width; | 16675 GLsizei level_width = width; |
16676 GLsizei level_height = height; | 16676 GLsizei level_height = height; |
16677 GLsizei level_depth = depth; | 16677 GLsizei level_depth = depth; |
16678 | 16678 |
| 16679 GLenum adjusted_internal_format = |
| 16680 feature_info_->context_type() == CONTEXT_TYPE_OPENGLES2 ? |
| 16681 format : internal_format; |
16679 for (int ii = 0; ii < levels; ++ii) { | 16682 for (int ii = 0; ii < levels; ++ii) { |
16680 if (target == GL_TEXTURE_CUBE_MAP) { | 16683 if (target == GL_TEXTURE_CUBE_MAP) { |
16681 for (int jj = 0; jj < 6; ++jj) { | 16684 for (int jj = 0; jj < 6; ++jj) { |
16682 GLenum face = GL_TEXTURE_CUBE_MAP_POSITIVE_X + jj; | 16685 GLenum face = GL_TEXTURE_CUBE_MAP_POSITIVE_X + jj; |
16683 texture_manager()->SetLevelInfo( | 16686 texture_manager()->SetLevelInfo( |
16684 texture_ref, face, ii, internal_format, level_width, level_height, | 16687 texture_ref, face, ii, adjusted_internal_format, level_width, |
16685 1, 0, format, type, gfx::Rect()); | 16688 level_height, 1, 0, format, type, gfx::Rect()); |
16686 } | 16689 } |
16687 } else { | 16690 } else { |
16688 texture_manager()->SetLevelInfo( | 16691 texture_manager()->SetLevelInfo( |
16689 texture_ref, target, ii, internal_format, level_width, level_height, | 16692 texture_ref, target, ii, adjusted_internal_format, level_width, |
16690 level_depth, 0, format, type, gfx::Rect()); | 16693 level_height, level_depth, 0, format, type, gfx::Rect()); |
16691 } | 16694 } |
16692 level_width = std::max(1, level_width >> 1); | 16695 level_width = std::max(1, level_width >> 1); |
16693 level_height = std::max(1, level_height >> 1); | 16696 level_height = std::max(1, level_height >> 1); |
16694 if (target == GL_TEXTURE_3D) | 16697 if (target == GL_TEXTURE_3D) |
16695 level_depth = std::max(1, level_depth >> 1); | 16698 level_depth = std::max(1, level_depth >> 1); |
16696 } | 16699 } |
16697 texture->SetImmutable(true); | 16700 texture->SetImmutable(true); |
16698 } | 16701 } |
16699 } | 16702 } |
16700 | 16703 |
(...skipping 2095 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
18796 } | 18799 } |
18797 | 18800 |
18798 // Include the auto-generated part of this file. We split this because it means | 18801 // Include the auto-generated part of this file. We split this because it means |
18799 // we can easily edit the non-auto generated parts right here in this file | 18802 // we can easily edit the non-auto generated parts right here in this file |
18800 // instead of having to edit some template or the code generator. | 18803 // instead of having to edit some template or the code generator. |
18801 #include "base/macros.h" | 18804 #include "base/macros.h" |
18802 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 18805 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
18803 | 18806 |
18804 } // namespace gles2 | 18807 } // namespace gles2 |
18805 } // namespace gpu | 18808 } // namespace gpu |
OLD | NEW |