summaryrefslogtreecommitdiffstats
path: root/gpu
diff options
context:
space:
mode:
authorboliu <boliu@chromium.org>2015-05-29 19:08:14 -0700
committerCommit bot <commit-bot@chromium.org>2015-05-30 02:08:59 +0000
commit043650c4a2dcb8f2be4a42781c090bb18d5d77f6 (patch)
treecfbbd21d9b93efba9e561907cabc0ee8ec5192a8 /gpu
parent9e1d8ee4cdf85f0c29cf3677f5394c7e92ccac0e (diff)
downloadchromium_src-043650c4a2dcb8f2be4a42781c090bb18d5d77f6.zip
chromium_src-043650c4a2dcb8f2be4a42781c090bb18d5d77f6.tar.gz
chromium_src-043650c4a2dcb8f2be4a42781c090bb18d5d77f6.tar.bz2
Avoid unncessary EGLImageTargetTexture calls
EGLImageTargetTexture is expensive on some drivers, and can be skipped if a texture is already bound to the EGLImage. BUG=492315 Review URL: https://codereview.chromium.org/1159293002 Cr-Commit-Position: refs/heads/master@{#332100}
Diffstat (limited to 'gpu')
-rw-r--r--gpu/command_buffer/service/texture_definition.cc10
1 files changed, 8 insertions, 2 deletions
diff --git a/gpu/command_buffer/service/texture_definition.cc b/gpu/command_buffer/service/texture_definition.cc
index 7b38f86..0c50a22 100644
--- a/gpu/command_buffer/service/texture_definition.cc
+++ b/gpu/command_buffer/service/texture_definition.cc
@@ -405,8 +405,14 @@ void TextureDefinition::UpdateTextureInternal(Texture* texture) const {
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, mag_filter_);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, wrap_s_);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, wrap_t_);
- if (image_buffer_.get())
- image_buffer_->BindToTexture(target_);
+
+ if (image_buffer_.get()) {
+ gfx::GLImage* existing_image = texture->GetLevelImage(target_, 0);
+ // Don't need to re-bind if already bound before.
+ if (!existing_image || !image_buffer_->IsClient(existing_image)) {
+ image_buffer_->BindToTexture(target_);
+ }
+ }
if (defined_) {
texture->face_infos_.resize(1);