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

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

Issue 2087663002: Simplify logic involving BackTexture. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@temp91
Patch Set: Fixes. Created 4 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 | « gpu/command_buffer/service/texture_manager.h ('k') | 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_manager.h" 5 #include "gpu/command_buffer/service/texture_manager.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 1680 matching lines...) Expand 10 before | Expand all | Expand 10 after
1691 bool Texture::EmulatingRGB() { 1691 bool Texture::EmulatingRGB() {
1692 return emulating_rgb_; 1692 return emulating_rgb_;
1693 } 1693 }
1694 1694
1695 TextureRef::TextureRef(TextureManager* manager, 1695 TextureRef::TextureRef(TextureManager* manager,
1696 GLuint client_id, 1696 GLuint client_id,
1697 Texture* texture) 1697 Texture* texture)
1698 : manager_(manager), 1698 : manager_(manager),
1699 texture_(texture), 1699 texture_(texture),
1700 client_id_(client_id), 1700 client_id_(client_id),
1701 num_observers_(0) { 1701 num_observers_(0),
1702 force_context_lost_(false) {
1702 DCHECK(manager_); 1703 DCHECK(manager_);
1703 DCHECK(texture_); 1704 DCHECK(texture_);
1704 texture_->AddTextureRef(this); 1705 texture_->AddTextureRef(this);
1705 manager_->StartTracking(this); 1706 manager_->StartTracking(this);
1706 } 1707 }
1707 1708
1708 scoped_refptr<TextureRef> TextureRef::Create(TextureManager* manager, 1709 scoped_refptr<TextureRef> TextureRef::Create(TextureManager* manager,
1709 GLuint client_id, 1710 GLuint client_id,
1710 GLuint service_id) { 1711 GLuint service_id) {
1711 return new TextureRef(manager, client_id, new Texture(service_id)); 1712 return new TextureRef(manager, client_id, new Texture(service_id));
1712 } 1713 }
1713 1714
1714 TextureRef::~TextureRef() { 1715 TextureRef::~TextureRef() {
1715 manager_->StopTracking(this); 1716 manager_->StopTracking(this);
1716 texture_->RemoveTextureRef(this, manager_->have_context_); 1717 texture_->RemoveTextureRef(
1718 this, force_context_lost_ ? false : manager_->have_context_);
1717 manager_ = NULL; 1719 manager_ = NULL;
1718 } 1720 }
1719 1721
1722 void TextureRef::ForceContextLost() {
1723 force_context_lost_ = true;
1724 }
1725
1720 TextureManager::TextureManager(MemoryTracker* memory_tracker, 1726 TextureManager::TextureManager(MemoryTracker* memory_tracker,
1721 FeatureInfo* feature_info, 1727 FeatureInfo* feature_info,
1722 GLint max_texture_size, 1728 GLint max_texture_size,
1723 GLint max_cube_map_texture_size, 1729 GLint max_cube_map_texture_size,
1724 GLint max_rectangle_texture_size, 1730 GLint max_rectangle_texture_size,
1725 GLint max_3d_texture_size, 1731 GLint max_3d_texture_size,
1726 GLint max_array_texture_layers, 1732 GLint max_array_texture_layers,
1727 bool use_default_textures) 1733 bool use_default_textures)
1728 : memory_type_tracker_(new MemoryTypeTracker(memory_tracker)), 1734 : memory_type_tracker_(new MemoryTypeTracker(memory_tracker)),
1729 memory_tracker_(memory_tracker), 1735 memory_tracker_(memory_tracker),
(...skipping 1622 matching lines...) Expand 10 before | Expand all | Expand 10 after
3352 uint32_t TextureManager::GetServiceIdGeneration() const { 3358 uint32_t TextureManager::GetServiceIdGeneration() const {
3353 return current_service_id_generation_; 3359 return current_service_id_generation_;
3354 } 3360 }
3355 3361
3356 void TextureManager::IncrementServiceIdGeneration() { 3362 void TextureManager::IncrementServiceIdGeneration() {
3357 current_service_id_generation_++; 3363 current_service_id_generation_++;
3358 } 3364 }
3359 3365
3360 } // namespace gles2 3366 } // namespace gles2
3361 } // namespace gpu 3367 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/texture_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698