OLD | NEW |
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 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 mailbox_manager_->TextureDeleted(this); | 365 mailbox_manager_->TextureDeleted(this); |
366 mailbox_manager_ = nullptr; | 366 mailbox_manager_ = nullptr; |
367 } | 367 } |
368 } | 368 } |
369 | 369 |
370 void TextureBase::SetMailboxManager(MailboxManager* mailbox_manager) { | 370 void TextureBase::SetMailboxManager(MailboxManager* mailbox_manager) { |
371 DCHECK(!mailbox_manager_ || mailbox_manager_ == mailbox_manager); | 371 DCHECK(!mailbox_manager_ || mailbox_manager_ == mailbox_manager); |
372 mailbox_manager_ = mailbox_manager; | 372 mailbox_manager_ = mailbox_manager; |
373 } | 373 } |
374 | 374 |
| 375 TexturePassthrough::TexturePassthrough(GLuint service_id) |
| 376 : TextureBase(service_id), have_context_(true) {} |
| 377 |
| 378 TexturePassthrough::~TexturePassthrough() { |
| 379 DeleteFromMailboxManager(); |
| 380 if (have_context_) { |
| 381 glDeleteTextures(1, &service_id_); |
| 382 } |
| 383 } |
| 384 |
| 385 void TexturePassthrough::MarkContextLost() { |
| 386 have_context_ = false; |
| 387 } |
| 388 |
375 Texture::Texture(GLuint service_id) | 389 Texture::Texture(GLuint service_id) |
376 : TextureBase(service_id), | 390 : TextureBase(service_id), |
377 memory_tracking_ref_(NULL), | 391 memory_tracking_ref_(NULL), |
378 owned_service_id_(service_id), | 392 owned_service_id_(service_id), |
379 cleared_(true), | 393 cleared_(true), |
380 num_uncleared_mips_(0), | 394 num_uncleared_mips_(0), |
381 num_npot_faces_(0), | 395 num_npot_faces_(0), |
382 target_(0), | 396 target_(0), |
383 usage_(GL_NONE), | 397 usage_(GL_NONE), |
384 base_level_(0), | 398 base_level_(0), |
(...skipping 3015 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3400 uint32_t TextureManager::GetServiceIdGeneration() const { | 3414 uint32_t TextureManager::GetServiceIdGeneration() const { |
3401 return current_service_id_generation_; | 3415 return current_service_id_generation_; |
3402 } | 3416 } |
3403 | 3417 |
3404 void TextureManager::IncrementServiceIdGeneration() { | 3418 void TextureManager::IncrementServiceIdGeneration() { |
3405 current_service_id_generation_++; | 3419 current_service_id_generation_++; |
3406 } | 3420 } |
3407 | 3421 |
3408 } // namespace gles2 | 3422 } // namespace gles2 |
3409 } // namespace gpu | 3423 } // namespace gpu |
OLD | NEW |