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 "gpu/command_buffer/common/gles2_cmd_utils.h" | 7 #include "gpu/command_buffer/common/gles2_cmd_utils.h" |
8 #include "gpu/command_buffer/service/feature_info.h" | 8 #include "gpu/command_buffer/service/feature_info.h" |
9 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" | 9 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" |
10 #include "gpu/command_buffer/service/mailbox_manager.h" | 10 #include "gpu/command_buffer/service/mailbox_manager.h" |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 if (owned_ && manager_->have_context_) { | 118 if (owned_ && manager_->have_context_) { |
119 GLuint id = service_id(); | 119 GLuint id = service_id(); |
120 glDeleteTextures(1, &id); | 120 glDeleteTextures(1, &id); |
121 } | 121 } |
122 MarkAsDeleted(); | 122 MarkAsDeleted(); |
123 manager_->StopTracking(this); | 123 manager_->StopTracking(this); |
124 manager_ = NULL; | 124 manager_ = NULL; |
125 } | 125 } |
126 } | 126 } |
127 | 127 |
| 128 TextureManager::TextureInfo::LevelInfo::LevelInfo() |
| 129 : cleared(true), |
| 130 target(0), |
| 131 level(-1), |
| 132 internal_format(0), |
| 133 width(0), |
| 134 height(0), |
| 135 depth(0), |
| 136 border(0), |
| 137 format(0), |
| 138 type(0), |
| 139 estimated_size(0) { |
| 140 } |
| 141 |
| 142 TextureManager::TextureInfo::LevelInfo::LevelInfo(const LevelInfo& rhs) |
| 143 : cleared(rhs.cleared), |
| 144 target(rhs.target), |
| 145 level(rhs.level), |
| 146 internal_format(rhs.internal_format), |
| 147 width(rhs.width), |
| 148 height(rhs.height), |
| 149 depth(rhs.depth), |
| 150 border(rhs.border), |
| 151 format(rhs.format), |
| 152 type(rhs.type), |
| 153 estimated_size(rhs.estimated_size) { |
| 154 } |
| 155 |
128 bool TextureManager::TextureInfo::CanRender( | 156 bool TextureManager::TextureInfo::CanRender( |
129 const FeatureInfo* feature_info) const { | 157 const FeatureInfo* feature_info) const { |
130 if (target_ == 0) { | 158 if (target_ == 0) { |
131 return false; | 159 return false; |
132 } | 160 } |
133 bool needs_mips = NeedsMips(); | 161 bool needs_mips = NeedsMips(); |
134 if ((npot() && !feature_info->feature_flags().npot_ok) || | 162 if ((npot() && !feature_info->feature_flags().npot_ok) || |
135 (target_ == GL_TEXTURE_RECTANGLE_ARB)) { | 163 (target_ == GL_TEXTURE_RECTANGLE_ARB)) { |
136 return !needs_mips && | 164 return !needs_mips && |
137 wrap_s_ == GL_CLAMP_TO_EDGE && | 165 wrap_s_ == GL_CLAMP_TO_EDGE && |
(...skipping 904 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1042 return false; | 1070 return false; |
1043 } | 1071 } |
1044 | 1072 |
1045 GLsizei TextureManager::ComputeMipMapCount( | 1073 GLsizei TextureManager::ComputeMipMapCount( |
1046 GLsizei width, GLsizei height, GLsizei depth) { | 1074 GLsizei width, GLsizei height, GLsizei depth) { |
1047 return 1 + base::bits::Log2Floor(std::max(std::max(width, height), depth)); | 1075 return 1 + base::bits::Log2Floor(std::max(std::max(width, height), depth)); |
1048 } | 1076 } |
1049 | 1077 |
1050 } // namespace gles2 | 1078 } // namespace gles2 |
1051 } // namespace gpu | 1079 } // namespace gpu |
1052 | |
1053 | |
OLD | NEW |