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/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
10 #include "base/memory/linked_ptr.h" | 10 #include "base/memory/linked_ptr.h" |
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 | 398 |
399 void TextureDefinition::UpdateTextureInternal(Texture* texture) const { | 399 void TextureDefinition::UpdateTextureInternal(Texture* texture) const { |
400 #if DCHECK_IS_ON() | 400 #if DCHECK_IS_ON() |
401 DCHECK(g_inside_scoped_update_texture.Get().Get()); | 401 DCHECK(g_inside_scoped_update_texture.Get().Get()); |
402 #endif | 402 #endif |
403 gfx::ScopedTextureBinder texture_binder(target_, texture->service_id()); | 403 gfx::ScopedTextureBinder texture_binder(target_, texture->service_id()); |
404 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, min_filter_); | 404 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, min_filter_); |
405 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, mag_filter_); | 405 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, mag_filter_); |
406 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, wrap_s_); | 406 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, wrap_s_); |
407 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, wrap_t_); | 407 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, wrap_t_); |
408 if (image_buffer_.get()) | 408 |
409 image_buffer_->BindToTexture(target_); | 409 if (image_buffer_.get()) { |
| 410 gfx::GLImage* existing_image = texture->GetLevelImage(target_, 0); |
| 411 // Don't need to re-bind if already bound before. |
| 412 if (!existing_image || !image_buffer_->IsClient(existing_image)) { |
| 413 image_buffer_->BindToTexture(target_); |
| 414 } |
| 415 } |
410 | 416 |
411 if (defined_) { | 417 if (defined_) { |
412 texture->face_infos_.resize(1); | 418 texture->face_infos_.resize(1); |
413 texture->face_infos_[0].level_infos.resize(1); | 419 texture->face_infos_[0].level_infos.resize(1); |
414 texture->SetLevelInfo(NULL, level_info_.target, 0, | 420 texture->SetLevelInfo(NULL, level_info_.target, 0, |
415 level_info_.internal_format, level_info_.width, | 421 level_info_.internal_format, level_info_.width, |
416 level_info_.height, level_info_.depth, | 422 level_info_.height, level_info_.depth, |
417 level_info_.border, level_info_.format, | 423 level_info_.border, level_info_.format, |
418 level_info_.type, level_info_.cleared); | 424 level_info_.type, level_info_.cleared); |
419 } | 425 } |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
480 | 486 |
481 return true; | 487 return true; |
482 } | 488 } |
483 | 489 |
484 bool TextureDefinition::SafeToRenderFrom() const { | 490 bool TextureDefinition::SafeToRenderFrom() const { |
485 return level_info_.cleared; | 491 return level_info_.cleared; |
486 } | 492 } |
487 | 493 |
488 } // namespace gles2 | 494 } // namespace gles2 |
489 } // namespace gpu | 495 } // namespace gpu |
OLD | NEW |