Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(335)

Side by Side Diff: gpu/command_buffer/service/texture_definition.cc

Issue 1159293002: Avoid unncessary EGLImageTargetTexture calls (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698