summaryrefslogtreecommitdiffstats
path: root/gpu/command_buffer/service/texture_manager.cc
diff options
context:
space:
mode:
Diffstat (limited to 'gpu/command_buffer/service/texture_manager.cc')
-rw-r--r--gpu/command_buffer/service/texture_manager.cc18
1 files changed, 17 insertions, 1 deletions
diff --git a/gpu/command_buffer/service/texture_manager.cc b/gpu/command_buffer/service/texture_manager.cc
index 117e951..486bdac 100644
--- a/gpu/command_buffer/service/texture_manager.cc
+++ b/gpu/command_buffer/service/texture_manager.cc
@@ -12,6 +12,7 @@
#include "gpu/command_buffer/service/gles2_cmd_decoder.h"
#include "gpu/command_buffer/service/mailbox_manager.h"
#include "gpu/command_buffer/service/memory_tracking.h"
+#include "gpu/command_buffer/service/stream_texture_manager.h"
namespace gpu {
namespace gles2 {
@@ -802,7 +803,8 @@ TextureRef::TextureRef(TextureManager* manager,
Texture* texture)
: manager_(manager),
texture_(texture),
- client_id_(client_id) {
+ client_id_(client_id),
+ is_stream_texture_owner_(false) {
DCHECK(manager_);
DCHECK(texture_);
texture_->AddTextureRef(this);
@@ -832,6 +834,7 @@ TextureManager::TextureManager(
new MemoryTypeTracker(memory_tracker, MemoryTracker::kUnmanaged)),
feature_info_(feature_info),
framebuffer_manager_(NULL),
+ stream_texture_manager_(NULL),
max_texture_size_(max_texture_size),
max_cube_map_texture_size_(max_cube_map_texture_size),
max_levels_(ComputeMipMapCount(max_texture_size,
@@ -979,7 +982,15 @@ void TextureManager::SetTarget(TextureRef* ref, GLenum target) {
void TextureManager::SetStreamTexture(TextureRef* ref, bool stream_texture) {
DCHECK(ref);
+ // Only the owner can mark as non-stream texture.
+ DCHECK_EQ(stream_texture, !ref->is_stream_texture_owner_);
ref->texture()->SetStreamTexture(stream_texture);
+ ref->set_is_stream_texture_owner(stream_texture);
+}
+
+bool TextureManager::IsStreamTextureOwner(TextureRef* ref) {
+ DCHECK(ref);
+ return ref->is_stream_texture_owner();
}
void TextureManager::SetLevelCleared(TextureRef* ref,
@@ -1128,6 +1139,11 @@ void TextureManager::StopTracking(TextureRef* ref) {
OnTextureRefDestroying(ref));
Texture* texture = ref->texture();
+ if (ref->is_stream_texture_owner_ && stream_texture_manager_) {
+ DCHECK(texture->IsStreamTexture());
+ stream_texture_manager_->DestroyStreamTexture(texture->service_id());
+ }
+
--texture_count_;
if (!texture->CanRender(feature_info_.get())) {
DCHECK_NE(0, num_unrenderable_textures_);