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 (const std::vector<LevelInfo>& face_info : level_infos_) { |
| 430 for (const LevelInfo& level_info : face_info) { |
| 431 if (!level_info.cleared) { |
| 432 return false; |
| 433 } |
| 434 } |
| 435 } |
| 436 return true; |
| 437 } |
| 438 |
427 } // namespace gles2 | 439 } // namespace gles2 |
428 } // namespace gpu | 440 } // namespace gpu |
OLD | NEW |