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/texture_manager.h" | 5 #include "gpu/command_buffer/service/texture_manager.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 3243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3254 { | 3254 { |
3255 ScopedTextureUploadTimer timer(texture_state); | 3255 ScopedTextureUploadTimer timer(texture_state); |
3256 if (args.command_type == DoTexImageArguments::kTexImage3D) { | 3256 if (args.command_type == DoTexImageArguments::kTexImage3D) { |
3257 glTexImage3D( | 3257 glTexImage3D( |
3258 args.target, args.level, | 3258 args.target, args.level, |
3259 AdjustTexInternalFormat(feature_info_.get(), args.internal_format), | 3259 AdjustTexInternalFormat(feature_info_.get(), args.internal_format), |
3260 args.width, args.height, args.depth, args.border, | 3260 args.width, args.height, args.depth, args.border, |
3261 AdjustTexFormat(feature_info_.get(), args.format), args.type, | 3261 AdjustTexFormat(feature_info_.get(), args.format), args.type, |
3262 args.pixels); | 3262 args.pixels); |
3263 } else { | 3263 } else { |
3264 if (texture_ref && | |
qiankun
2017/04/26 04:16:20
texture_ref should be always non-null here.
yizhou.jiang
2017/04/27 04:23:22
Done.
| |
3265 feature_info_->workarounds().reset_teximage2d_base_level) { | |
3266 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 0); | |
3267 } | |
3264 glTexImage2D( | 3268 glTexImage2D( |
3265 args.target, args.level, | 3269 args.target, args.level, |
3266 AdjustTexInternalFormat(feature_info_.get(), args.internal_format), | 3270 AdjustTexInternalFormat(feature_info_.get(), args.internal_format), |
3267 args.width, args.height, args.border, | 3271 args.width, args.height, args.border, |
3268 AdjustTexFormat(feature_info_.get(), args.format), args.type, | 3272 AdjustTexFormat(feature_info_.get(), args.format), args.type, |
3269 args.pixels); | 3273 args.pixels); |
3274 if (texture_ref && | |
3275 feature_info_->workarounds().reset_teximage2d_base_level) { | |
3276 Texture* texture = texture_ref->texture(); | |
3277 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, | |
3278 texture->base_level()); | |
3279 } | |
3270 } | 3280 } |
3271 } | 3281 } |
3272 GLenum error = ERRORSTATE_PEEK_GL_ERROR(error_state, function_name); | 3282 GLenum error = ERRORSTATE_PEEK_GL_ERROR(error_state, function_name); |
3273 if (args.command_type == DoTexImageArguments::kTexImage3D) { | 3283 if (args.command_type == DoTexImageArguments::kTexImage3D) { |
3274 UMA_HISTOGRAM_CUSTOM_ENUMERATION("GPU.Error_TexImage3D", error, | 3284 UMA_HISTOGRAM_CUSTOM_ENUMERATION("GPU.Error_TexImage3D", error, |
3275 GetAllGLErrors()); | 3285 GetAllGLErrors()); |
3276 } else { | 3286 } else { |
3277 UMA_HISTOGRAM_CUSTOM_ENUMERATION("GPU.Error_TexImage2D", error, | 3287 UMA_HISTOGRAM_CUSTOM_ENUMERATION("GPU.Error_TexImage2D", error, |
3278 GetAllGLErrors()); | 3288 GetAllGLErrors()); |
3279 } | 3289 } |
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3684 uint32_t TextureManager::GetServiceIdGeneration() const { | 3694 uint32_t TextureManager::GetServiceIdGeneration() const { |
3685 return current_service_id_generation_; | 3695 return current_service_id_generation_; |
3686 } | 3696 } |
3687 | 3697 |
3688 void TextureManager::IncrementServiceIdGeneration() { | 3698 void TextureManager::IncrementServiceIdGeneration() { |
3689 current_service_id_generation_++; | 3699 current_service_id_generation_++; |
3690 } | 3700 } |
3691 | 3701 |
3692 } // namespace gles2 | 3702 } // namespace gles2 |
3693 } // namespace gpu | 3703 } // namespace gpu |
OLD | NEW |