| 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 #include "base/bits.h" | 6 #include "base/bits.h" |
| 7 #include "base/strings/stringprintf.h" | 7 #include "base/strings/stringprintf.h" |
| 8 #include "gpu/command_buffer/common/gles2_cmd_utils.h" | 8 #include "gpu/command_buffer/common/gles2_cmd_utils.h" |
| 9 #include "gpu/command_buffer/service/context_state.h" | 9 #include "gpu/command_buffer/service/context_state.h" |
| 10 #include "gpu/command_buffer/service/error_state.h" | 10 #include "gpu/command_buffer/service/error_state.h" |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 pool_(GL_TEXTURE_POOL_UNMANAGED_CHROMIUM), | 112 pool_(GL_TEXTURE_POOL_UNMANAGED_CHROMIUM), |
| 113 max_level_set_(-1), | 113 max_level_set_(-1), |
| 114 texture_complete_(false), | 114 texture_complete_(false), |
| 115 cube_complete_(false), | 115 cube_complete_(false), |
| 116 npot_(false), | 116 npot_(false), |
| 117 has_been_bound_(false), | 117 has_been_bound_(false), |
| 118 framebuffer_attachment_count_(0), | 118 framebuffer_attachment_count_(0), |
| 119 immutable_(false), | 119 immutable_(false), |
| 120 has_images_(false), | 120 has_images_(false), |
| 121 estimated_size_(0), | 121 estimated_size_(0), |
| 122 can_render_condition_(CAN_RENDER_ALWAYS) { | 122 can_render_condition_(CAN_RENDER_ALWAYS), |
| 123 texture_max_anisotropy_initialized_(false) { |
| 123 } | 124 } |
| 124 | 125 |
| 125 Texture::~Texture() { | 126 Texture::~Texture() { |
| 126 if (mailbox_manager_) | 127 if (mailbox_manager_) |
| 127 mailbox_manager_->TextureDeleted(this); | 128 mailbox_manager_->TextureDeleted(this); |
| 128 } | 129 } |
| 129 | 130 |
| 130 void Texture::AddTextureRef(TextureRef* ref) { | 131 void Texture::AddTextureRef(TextureRef* ref) { |
| 131 DCHECK(refs_.find(ref) == refs_.end()); | 132 DCHECK(refs_.find(ref) == refs_.end()); |
| 132 refs_.insert(ref); | 133 refs_.insert(ref); |
| (...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 748 if (face_index >= level_infos_.size() || | 749 if (face_index >= level_infos_.size() || |
| 749 level >= static_cast<GLint>(level_infos_[face_index].size())) { | 750 level >= static_cast<GLint>(level_infos_[face_index].size())) { |
| 750 return true; | 751 return true; |
| 751 } | 752 } |
| 752 | 753 |
| 753 const Texture::LevelInfo& info = level_infos_[face_index][level]; | 754 const Texture::LevelInfo& info = level_infos_[face_index][level]; |
| 754 | 755 |
| 755 return info.cleared; | 756 return info.cleared; |
| 756 } | 757 } |
| 757 | 758 |
| 759 void Texture::InitTextureMaxAnisotropyIfNeeded(GLenum target) { |
| 760 if (texture_max_anisotropy_initialized_) |
| 761 return; |
| 762 texture_max_anisotropy_initialized_ = true; |
| 763 GLfloat params[] = { 1.0f }; |
| 764 glTexParameterfv(target, GL_TEXTURE_MAX_ANISOTROPY_EXT, params); |
| 765 } |
| 766 |
| 758 bool Texture::ClearLevel( | 767 bool Texture::ClearLevel( |
| 759 GLES2Decoder* decoder, GLenum target, GLint level) { | 768 GLES2Decoder* decoder, GLenum target, GLint level) { |
| 760 DCHECK(decoder); | 769 DCHECK(decoder); |
| 761 size_t face_index = GLTargetToFaceIndex(target); | 770 size_t face_index = GLTargetToFaceIndex(target); |
| 762 if (face_index >= level_infos_.size() || | 771 if (face_index >= level_infos_.size() || |
| 763 level >= static_cast<GLint>(level_infos_[face_index].size())) { | 772 level >= static_cast<GLint>(level_infos_[face_index].size())) { |
| 764 return true; | 773 return true; |
| 765 } | 774 } |
| 766 | 775 |
| 767 Texture::LevelInfo& info = level_infos_[face_index][level]; | 776 Texture::LevelInfo& info = level_infos_[face_index][level]; |
| (...skipping 725 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1493 } | 1502 } |
| 1494 | 1503 |
| 1495 ScopedTextureUploadTimer::~ScopedTextureUploadTimer() { | 1504 ScopedTextureUploadTimer::~ScopedTextureUploadTimer() { |
| 1496 texture_state_->texture_upload_count++; | 1505 texture_state_->texture_upload_count++; |
| 1497 texture_state_->total_texture_upload_time += | 1506 texture_state_->total_texture_upload_time += |
| 1498 base::TimeTicks::HighResNow() - begin_time_; | 1507 base::TimeTicks::HighResNow() - begin_time_; |
| 1499 } | 1508 } |
| 1500 | 1509 |
| 1501 } // namespace gles2 | 1510 } // namespace gles2 |
| 1502 } // namespace gpu | 1511 } // namespace gpu |
| OLD | NEW |