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 16389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
16400 depth); | 16400 depth); |
16401 } | 16401 } |
16402 if (workarounds().reset_base_mipmap_level_before_texstorage && | 16402 if (workarounds().reset_base_mipmap_level_before_texstorage && |
16403 texture->base_level() > 0) | 16403 texture->base_level() > 0) |
16404 glTexParameteri(target, GL_TEXTURE_BASE_LEVEL, texture->base_level()); | 16404 glTexParameteri(target, GL_TEXTURE_BASE_LEVEL, texture->base_level()); |
16405 | 16405 |
16406 { | 16406 { |
16407 GLsizei level_width = width; | 16407 GLsizei level_width = width; |
16408 GLsizei level_height = height; | 16408 GLsizei level_height = height; |
16409 GLsizei level_depth = depth; | 16409 GLsizei level_depth = depth; |
| 16410 GLenum adjusted_format = |
| 16411 feature_info_->IsES3Enabled() ? internal_format : format; |
16410 for (int ii = 0; ii < levels; ++ii) { | 16412 for (int ii = 0; ii < levels; ++ii) { |
16411 if (target == GL_TEXTURE_CUBE_MAP) { | 16413 if (target == GL_TEXTURE_CUBE_MAP) { |
16412 for (int jj = 0; jj < 6; ++jj) { | 16414 for (int jj = 0; jj < 6; ++jj) { |
16413 GLenum face = GL_TEXTURE_CUBE_MAP_POSITIVE_X + jj; | 16415 GLenum face = GL_TEXTURE_CUBE_MAP_POSITIVE_X + jj; |
16414 texture_manager()->SetLevelInfo( | 16416 texture_manager()->SetLevelInfo(texture_ref, face, ii, |
16415 texture_ref, face, ii, internal_format, level_width, level_height, | 16417 adjusted_format, |
16416 1, 0, format, type, gfx::Rect()); | 16418 level_width, level_height, 1, |
| 16419 0, format, type, gfx::Rect()); |
16417 } | 16420 } |
16418 } else { | 16421 } else { |
16419 texture_manager()->SetLevelInfo( | 16422 texture_manager()->SetLevelInfo(texture_ref, target, ii, |
16420 texture_ref, target, ii, internal_format, level_width, level_height, | 16423 adjusted_format, |
16421 level_depth, 0, format, type, gfx::Rect()); | 16424 level_width, level_height, level_depth, |
| 16425 0, format, type, gfx::Rect()); |
16422 } | 16426 } |
16423 level_width = std::max(1, level_width >> 1); | 16427 level_width = std::max(1, level_width >> 1); |
16424 level_height = std::max(1, level_height >> 1); | 16428 level_height = std::max(1, level_height >> 1); |
16425 if (target == GL_TEXTURE_3D) | 16429 if (target == GL_TEXTURE_3D) |
16426 level_depth = std::max(1, level_depth >> 1); | 16430 level_depth = std::max(1, level_depth >> 1); |
16427 } | 16431 } |
16428 texture->SetImmutable(true); | 16432 texture->SetImmutable(true); |
16429 } | 16433 } |
16430 } | 16434 } |
16431 | 16435 |
(...skipping 2083 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
18515 } | 18519 } |
18516 | 18520 |
18517 // Include the auto-generated part of this file. We split this because it means | 18521 // Include the auto-generated part of this file. We split this because it means |
18518 // we can easily edit the non-auto generated parts right here in this file | 18522 // we can easily edit the non-auto generated parts right here in this file |
18519 // instead of having to edit some template or the code generator. | 18523 // instead of having to edit some template or the code generator. |
18520 #include "base/macros.h" | 18524 #include "base/macros.h" |
18521 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 18525 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
18522 | 18526 |
18523 } // namespace gles2 | 18527 } // namespace gles2 |
18524 } // namespace gpu | 18528 } // namespace gpu |
OLD | NEW |