Chromium Code Reviews| 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 <algorithm> | 7 #include <algorithm> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bits.h" | 10 #include "base/bits.h" |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 213 DCHECK(feature_info); | 213 DCHECK(feature_info); |
| 214 DCHECK(signature); | 214 DCHECK(signature); |
| 215 DCHECK_GE(level, 0); | 215 DCHECK_GE(level, 0); |
| 216 size_t face_index = GLES2Util::GLTargetToFaceIndex(target); | 216 size_t face_index = GLES2Util::GLTargetToFaceIndex(target); |
| 217 DCHECK_LT(static_cast<size_t>(face_index), | 217 DCHECK_LT(static_cast<size_t>(face_index), |
| 218 level_infos_.size()); | 218 level_infos_.size()); |
| 219 DCHECK_LT(static_cast<size_t>(level), | 219 DCHECK_LT(static_cast<size_t>(level), |
| 220 level_infos_[face_index].size()); | 220 level_infos_[face_index].size()); |
| 221 const Texture::LevelInfo& info = | 221 const Texture::LevelInfo& info = |
| 222 level_infos_[face_index][level]; | 222 level_infos_[face_index][level]; |
| 223 *signature += base::StringPrintf( | 223 |
| 224 "|Texture|target=%04x|level=%d|internal_format=%04x" | 224 signature->append("|Texture|"); |
| 225 "|width=%d|height=%d|depth=%d|border=%d|format=%04x|type=%04x" | 225 signature->append(reinterpret_cast<const char*>(&target), sizeof(target)); |
| 226 "|image=%d|canrender=%d|canrenderto=%d|npot_=%d" | 226 signature->append(reinterpret_cast<const char*>(&level), sizeof(level)); |
| 227 "|min_filter=%04x|mag_filter=%04x|wrap_s=%04x|wrap_t=%04x" | 227 signature->append(reinterpret_cast<const char*>(&info.internal_format), |
| 228 "|usage=%04x", | 228 sizeof(info.internal_format)); |
| 229 target, level, info.internal_format, | 229 signature->append(reinterpret_cast<const char*>(&info.width), |
| 230 info.width, info.height, info.depth, info.border, | 230 sizeof(info.width)); |
| 231 info.format, info.type, info.image.get() != NULL, | 231 signature->append(reinterpret_cast<const char*>(&info.height), |
| 232 CanRender(feature_info), CanRenderTo(), npot_, | 232 sizeof(info.height)); |
| 233 min_filter_, mag_filter_, wrap_s_, wrap_t_, | 233 signature->append(reinterpret_cast<const char*>(&info.depth), |
| 234 usage_); | 234 sizeof(info.depth)); |
| 235 signature->append(reinterpret_cast<const char*>(&info.border), | |
| 236 sizeof(info.border)); | |
| 237 signature->append(reinterpret_cast<const char*>(&info.format), | |
| 238 sizeof(info.format)); | |
| 239 signature->append(reinterpret_cast<const char*>(&info.type), | |
| 240 sizeof(info.type)); | |
| 241 | |
| 242 const bool has_image = info.image.get() != NULL; | |
| 243 signature->append(reinterpret_cast<const char*>(&has_image), | |
| 244 sizeof(has_image)); | |
| 245 | |
| 246 const bool can_render = CanRender(feature_info); | |
| 247 signature->append(reinterpret_cast<const char*>(&can_render), | |
| 248 sizeof(can_render)); | |
| 249 | |
| 250 const bool can_render_to = CanRenderTo(); | |
| 251 signature->append(reinterpret_cast<const char*>(&can_render_to), | |
| 252 sizeof(can_render_to)); | |
| 253 | |
| 254 signature->append(reinterpret_cast<const char*>(&npot_), | |
| 255 sizeof(npot_)); | |
| 256 signature->append(reinterpret_cast<const char*>(&min_filter_), | |
| 257 sizeof(min_filter_)); | |
| 258 signature->append(reinterpret_cast<const char*>(&wrap_s_), | |
| 259 sizeof(wrap_s_)); | |
| 260 signature->append(reinterpret_cast<const char*>(&wrap_t_), | |
| 261 sizeof(wrap_t_)); | |
| 262 signature->append(reinterpret_cast<const char*>(&usage_), | |
| 263 sizeof(usage_)); | |
|
vmiura
2014/09/23 20:26:47
As with Renderbuffer, would these be better if pac
| |
| 235 } | 264 } |
| 236 | 265 |
| 237 void Texture::SetMailboxManager(MailboxManager* mailbox_manager) { | 266 void Texture::SetMailboxManager(MailboxManager* mailbox_manager) { |
| 238 DCHECK(!mailbox_manager_ || mailbox_manager_ == mailbox_manager); | 267 DCHECK(!mailbox_manager_ || mailbox_manager_ == mailbox_manager); |
| 239 mailbox_manager_ = mailbox_manager; | 268 mailbox_manager_ = mailbox_manager; |
| 240 } | 269 } |
| 241 | 270 |
| 242 bool Texture::MarkMipmapsGenerated( | 271 bool Texture::MarkMipmapsGenerated( |
| 243 const FeatureInfo* feature_info) { | 272 const FeatureInfo* feature_info) { |
| 244 if (!CanGenerateMipmaps(feature_info)) { | 273 if (!CanGenerateMipmaps(feature_info)) { |
| (...skipping 1298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1543 } | 1572 } |
| 1544 | 1573 |
| 1545 ScopedTextureUploadTimer::~ScopedTextureUploadTimer() { | 1574 ScopedTextureUploadTimer::~ScopedTextureUploadTimer() { |
| 1546 texture_state_->texture_upload_count++; | 1575 texture_state_->texture_upload_count++; |
| 1547 texture_state_->total_texture_upload_time += | 1576 texture_state_->total_texture_upload_time += |
| 1548 base::TimeTicks::HighResNow() - begin_time_; | 1577 base::TimeTicks::HighResNow() - begin_time_; |
| 1549 } | 1578 } |
| 1550 | 1579 |
| 1551 } // namespace gles2 | 1580 } // namespace gles2 |
| 1552 } // namespace gpu | 1581 } // namespace gpu |
| OLD | NEW |