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

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

Issue 14188053: gpu: Change Produce/ConsumeTexture to allow texture sharing (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: gpu/command_buffer/service/mailbox_manager.cc
diff --git a/gpu/command_buffer/service/mailbox_manager.cc b/gpu/command_buffer/service/mailbox_manager.cc
index 90193934f3a4dd40ba797266978847b653241e69..5e27047e710106e8416ce4dff6c972223e04dde7 100644
--- a/gpu/command_buffer/service/mailbox_manager.cc
+++ b/gpu/command_buffer/service/mailbox_manager.cc
@@ -9,7 +9,7 @@
#include "base/rand_util.h"
#include "crypto/hmac.h"
#include "gpu/command_buffer/service/gl_utils.h"
no sievers 2013/05/24 01:31:38 nit: I think gl_utils.h is not needed anymore.
piman 2013/05/24 02:32:22 Done.
-#include "gpu/command_buffer/service/texture_definition.h"
+#include "gpu/command_buffer/service/texture_manager.h"
namespace gpu {
namespace gles2 {
@@ -38,57 +38,41 @@ void MailboxManager::GenerateMailboxName(MailboxName* name) {
SignMailboxName(name);
}
-TextureDefinition* MailboxManager::ConsumeTexture(unsigned target,
- const MailboxName& name) {
+Texture* MailboxManager::ConsumeTexture(unsigned target,
+ const MailboxName& name) {
if (!IsMailboxNameValid(name))
return NULL;
- TextureDefinitionMap::iterator it =
- textures_.find(TargetName(target, name));
+ TextureMap::iterator it = textures_.find(TargetName(target, name));
if (it == textures_.end())
return NULL;
- TextureDefinition* definition = it->second.definition.release();
- textures_.erase(it);
-
- return definition;
+ return it->second;
}
bool MailboxManager::ProduceTexture(unsigned target,
const MailboxName& name,
- TextureDefinition* definition,
- TextureManager* owner) {
+ Texture* texture) {
if (!IsMailboxNameValid(name))
return false;
- TextureDefinitionMap::iterator it =
- textures_.find(TargetName(target, name));
- if (it != textures_.end()) {
- NOTREACHED();
- GLuint service_id = it->second.definition->ReleaseServiceId();
- glDeleteTextures(1, &service_id);
- it->second = OwnedTextureDefinition(definition, owner);
- } else {
- textures_.insert(std::make_pair(
- TargetName(target, name),
- OwnedTextureDefinition(definition, owner)));
- }
+ texture->SetMailboxManager(this);
+ TextureMap::iterator it = textures_.find(TargetName(target, name));
+ if (it != textures_.end())
+ it->second = texture;
+ else
+ textures_.insert(std::make_pair(TargetName(target, name), texture));
return true;
}
-void MailboxManager::DestroyOwnedTextures(TextureManager* owner,
- bool have_context) {
- TextureDefinitionMap::iterator it = textures_.begin();
+void MailboxManager::TextureDeleted(Texture* texture) {
+ TextureMap::iterator it = textures_.begin();
while (it != textures_.end()) {
apatrick_chromium 2013/05/23 18:37:11 This might now be a more common operation. Before
piman 2013/05/24 02:32:22 Done.
- TextureDefinitionMap::iterator current_it = it;
+ TextureMap::iterator current_it = it;
++it;
- if (current_it->second.owner == owner) {
- GLuint service_id = current_it->second.definition->ReleaseServiceId();
- if (have_context)
- glDeleteTextures(1, &service_id);
+ if (current_it->second == texture)
textures_.erase(current_it);
- }
}
}
@@ -118,15 +102,5 @@ bool MailboxManager::TargetNameLess(const MailboxManager::TargetName& lhs,
return memcmp(&lhs, &rhs, sizeof(lhs)) < 0;
}
-MailboxManager::OwnedTextureDefinition::OwnedTextureDefinition(
- TextureDefinition* definition,
- TextureManager* owner)
- : definition(definition),
- owner(owner) {
-}
-
-MailboxManager::OwnedTextureDefinition::~OwnedTextureDefinition() {
-}
-
} // namespace gles2
} // namespace gpu

Powered by Google App Engine
This is Rietveld 408576698