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

Unified Diff: gpu/command_buffer/service/texture_manager.cc

Issue 2518413002: Add validation to the mailbox functions in the passthrough cmd decoder. (Closed)
Patch Set: Fix explicit. Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gpu/command_buffer/service/texture_manager.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/command_buffer/service/texture_manager.cc
diff --git a/gpu/command_buffer/service/texture_manager.cc b/gpu/command_buffer/service/texture_manager.cc
index bdec5d071f2e1f34d7bed5fc825e17e5a7eef936..b02272b86a24c7937440bbe28a2d8a531f65484b 100644
--- a/gpu/command_buffer/service/texture_manager.cc
+++ b/gpu/command_buffer/service/texture_manager.cc
@@ -439,12 +439,17 @@ void TextureManager::Destroy(bool have_context) {
}
TextureBase::TextureBase(GLuint service_id)
- : service_id_(service_id), mailbox_manager_(nullptr) {}
+ : service_id_(service_id), target_(GL_NONE), mailbox_manager_(nullptr) {}
TextureBase::~TextureBase() {
DCHECK_EQ(nullptr, mailbox_manager_);
}
+void TextureBase::SetTarget(GLenum target) {
+ DCHECK_EQ(0u, target_); // you can only set this once.
+ target_ = target;
+}
+
void TextureBase::DeleteFromMailboxManager() {
if (mailbox_manager_) {
mailbox_manager_->TextureDeleted(this);
@@ -457,8 +462,10 @@ void TextureBase::SetMailboxManager(MailboxManager* mailbox_manager) {
mailbox_manager_ = mailbox_manager;
}
-TexturePassthrough::TexturePassthrough(GLuint service_id)
- : TextureBase(service_id), have_context_(true) {}
+TexturePassthrough::TexturePassthrough(GLuint service_id, GLenum target)
+ : TextureBase(service_id), have_context_(true) {
+ TextureBase::SetTarget(target);
+}
TexturePassthrough::~TexturePassthrough() {
DeleteFromMailboxManager();
@@ -478,7 +485,6 @@ Texture::Texture(GLuint service_id)
cleared_(true),
num_uncleared_mips_(0),
num_npot_faces_(0),
- target_(0),
usage_(GL_NONE),
base_level_(0),
max_level_(1000),
@@ -746,8 +752,7 @@ void Texture::MarkMipmapsGenerated() {
}
void Texture::SetTarget(GLenum target, GLint max_levels) {
- DCHECK_EQ(0u, target_); // you can only set this once.
- target_ = target;
+ TextureBase::SetTarget(target);
size_t num_faces = (target == GL_TEXTURE_CUBE_MAP) ? 6 : 1;
face_infos_.resize(num_faces);
for (size_t ii = 0; ii < num_faces; ++ii) {
« 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