Chromium Code Reviews| 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 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 GLint bound_id = 0; | |
| 416 glGetIntegerv(target_, &bound_id); | |
|
no sievers
2015/04/29 21:04:43
This doesn't work. It will generate a GL error I a
boliu
2015/04/29 21:16:14
Meh, missed the giant block doing the GL_TEXTURE2D
| |
| 417 if (bound_id == static_cast<GLint>(old_service_id)) { | |
| 418 glBindTexture(target_, service_id); | |
| 419 } | |
| 414 } | 420 } |
| 415 | 421 |
| 416 UpdateTextureInternal(texture); | 422 UpdateTextureInternal(texture); |
| 417 | 423 |
| 418 if (old_service_id) { | 424 if (old_service_id) { |
| 419 glDeleteTextures(1, &old_service_id); | 425 glDeleteTextures(1, &old_service_id); |
| 420 } | 426 } |
| 421 } | 427 } |
| 422 | 428 |
| 423 bool TextureDefinition::Matches(const Texture* texture) const { | 429 bool TextureDefinition::Matches(const Texture* texture) const { |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 440 | 446 |
| 441 return true; | 447 return true; |
| 442 } | 448 } |
| 443 | 449 |
| 444 bool TextureDefinition::SafeToRenderFrom() const { | 450 bool TextureDefinition::SafeToRenderFrom() const { |
| 445 return level_info_.cleared; | 451 return level_info_.cleared; |
| 446 } | 452 } |
| 447 | 453 |
| 448 } // namespace gles2 | 454 } // namespace gles2 |
| 449 } // namespace gpu | 455 } // namespace gpu |
| OLD | NEW |