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

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

Issue 1115043003: Handle currently bound texture id in PowerVR workaround (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: GL_TEXTURE_BINDING_2D Created 5 years, 7 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/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 393 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 texture->usage_ = usage_; 404 texture->usage_ = usage_;
405 } 405 }
406 406
407 void TextureDefinition::UpdateTexture(Texture* texture) const { 407 void TextureDefinition::UpdateTexture(Texture* texture) const {
408 GLuint old_service_id = 0u; 408 GLuint old_service_id = 0u;
409 if (image_buffer_.get() && g_avoid_egl_target_texture_reuse) { 409 if (image_buffer_.get() && g_avoid_egl_target_texture_reuse) {
410 GLuint service_id = 0u; 410 GLuint service_id = 0u;
411 glGenTextures(1, &service_id); 411 glGenTextures(1, &service_id);
412 old_service_id = texture->service_id(); 412 old_service_id = texture->service_id();
413 texture->SetServiceId(service_id); 413 texture->SetServiceId(service_id);
414
415 DCHECK_EQ(static_cast<GLenum>(GL_TEXTURE_2D), target_);
416 GLint bound_id = 0;
417 glGetIntegerv(GL_TEXTURE_BINDING_2D, &bound_id);
418 if (bound_id == static_cast<GLint>(old_service_id)) {
419 glBindTexture(target_, service_id);
420 }
414 } 421 }
415 422
416 UpdateTextureInternal(texture); 423 UpdateTextureInternal(texture);
417 424
418 if (old_service_id) { 425 if (old_service_id) {
419 glDeleteTextures(1, &old_service_id); 426 glDeleteTextures(1, &old_service_id);
420 } 427 }
421 } 428 }
422 429
423 bool TextureDefinition::Matches(const Texture* texture) const { 430 bool TextureDefinition::Matches(const Texture* texture) const {
(...skipping 16 matching lines...) Expand all
440 447
441 return true; 448 return true;
442 } 449 }
443 450
444 bool TextureDefinition::SafeToRenderFrom() const { 451 bool TextureDefinition::SafeToRenderFrom() const {
445 return level_info_.cleared; 452 return level_info_.cleared;
446 } 453 }
447 454
448 } // namespace gles2 455 } // namespace gles2
449 } // namespace gpu 456 } // 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