Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_definition.h" | 5 #include "gpu/command_buffer/service/texture_definition.h" |
| 6 | 6 |
| 7 #include <list> | 7 #include <list> |
| 8 | 8 |
| 9 #include "base/memory/linked_ptr.h" | 9 #include "base/memory/linked_ptr.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 406 texture->wrap_s_ = wrap_s_; | 406 texture->wrap_s_ = wrap_s_; |
| 407 texture->wrap_t_ = wrap_t_; | 407 texture->wrap_t_ = wrap_t_; |
| 408 texture->usage_ = usage_; | 408 texture->usage_ = usage_; |
| 409 } | 409 } |
| 410 | 410 |
| 411 bool TextureDefinition::Matches(const Texture* texture) const { | 411 bool TextureDefinition::Matches(const Texture* texture) const { |
| 412 DCHECK(target_ == texture->target()); | 412 DCHECK(target_ == texture->target()); |
| 413 if (texture->min_filter_ != min_filter_ || | 413 if (texture->min_filter_ != min_filter_ || |
| 414 texture->mag_filter_ != mag_filter_ || | 414 texture->mag_filter_ != mag_filter_ || |
| 415 texture->wrap_s_ != wrap_s_ || | 415 texture->wrap_s_ != wrap_s_ || |
| 416 texture->wrap_t_ != wrap_t_) { | 416 texture->wrap_t_ != wrap_t_ || |
| 417 texture->SafeToRenderFrom() != SafeToRenderFrom()) { | |
| 417 return false; | 418 return false; |
| 418 } | 419 } |
| 419 | 420 |
| 420 // All structural changes should have orphaned the texture. | 421 // All structural changes should have orphaned the texture. |
| 421 if (image_buffer_.get() && !texture->GetLevelImage(texture->target(), 0)) | 422 if (image_buffer_.get() && !texture->GetLevelImage(texture->target(), 0)) |
| 422 return false; | 423 return false; |
| 423 | 424 |
| 424 return true; | 425 return true; |
| 425 } | 426 } |
| 426 | 427 |
| 428 bool TextureDefinition::SafeToRenderFrom() const { | |
| 429 for (size_t i = 0; i < level_infos_.size(); i++) { | |
| 430 const std::vector<LevelInfo>& face_info = level_infos_[i]; | |
| 431 for (size_t j = 0; j < face_info.size(); ++j) { | |
|
no sievers
2015/01/29 20:23:49
for (const std::vector<LevelInfo>& face_info : lev
boliu
2015/01/29 22:04:34
Done. c++11 all the way!
| |
| 432 if (!face_info[j].cleared) { | |
| 433 return false; | |
| 434 } | |
| 435 } | |
| 436 } | |
| 437 return true; | |
| 438 } | |
| 439 | |
| 427 } // namespace gles2 | 440 } // namespace gles2 |
| 428 } // namespace gpu | 441 } // namespace gpu |
| OLD | NEW |