summaryrefslogtreecommitdiffstats
path: root/content/common
diff options
context:
space:
mode:
authorapatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-01 21:50:59 +0000
committerapatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-01 21:50:59 +0000
commit78b514be30c67dad84bb8e2b6dfac3cfb15c79ff (patch)
treedd7d62dafa82bd6fbe087fb6f4de8148939c34ee /content/common
parent107d6e00cece1fb1545f5403193576f822e93a09 (diff)
downloadchromium_src-78b514be30c67dad84bb8e2b6dfac3cfb15c79ff.zip
chromium_src-78b514be30c67dad84bb8e2b6dfac3cfb15c79ff.tar.gz
chromium_src-78b514be30c67dad84bb8e2b6dfac3cfb15c79ff.tar.bz2
Allow textures to be moved from one GL context group to another.
The function glProduceTexture(target, mailbox) removes a texture from a context group and puts it in a "mailbox" that is accessible to all context groups on the same channel. Then glConsumeTexture(target, mailbox) adds the texture to a context group, possibly a different one, if the caller knows the name of the mailbox. From the point of view of the caller, the texture objects themselves do not move, just the texels. In terms of the underlying GL, the TextureInfo service IDs are reassigned as necessary. A texture in a mailbox is destroyed when the context group that put it there is destroyed. Expected usage is: // Context 1 glBindTexture(GL_TEXTURE_2D, foo); glProduceTexture(GL_TEXTURE_2D, secret_name); glFlush(); // Context 2 glBindTexture(GL_TEXTURE_2D, bar); glConsumeTexture(GL_TEXTURE_2D, secret_name); Review URL: http://codereview.chromium.org/10106015 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@134791 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/common')
-rw-r--r--content/common/gpu/gpu_channel.cc4
-rw-r--r--content/common/gpu/gpu_channel.h2
-rw-r--r--content/common/gpu/gpu_command_buffer_stub.cc3
-rw-r--r--content/common/gpu/gpu_command_buffer_stub.h7
4 files changed, 15 insertions, 1 deletions
diff --git a/content/common/gpu/gpu_channel.cc b/content/common/gpu/gpu_channel.cc
index 9785ce7..a93c5b6 100644
--- a/content/common/gpu/gpu_channel.cc
+++ b/content/common/gpu/gpu_channel.cc
@@ -18,6 +18,7 @@
#include "content/common/gpu/gpu_messages.h"
#include "content/public/common/content_client.h"
#include "content/public/common/content_switches.h"
+#include "gpu/command_buffer/service/mailbox_manager.h"
#include "ui/gfx/gl/gl_context.h"
#include "ui/gfx/gl/gl_surface.h"
@@ -41,6 +42,7 @@ GpuChannel::GpuChannel(GpuChannelManager* gpu_channel_manager,
: gpu_channel_manager_(gpu_channel_manager),
client_id_(client_id),
share_group_(share_group ? share_group : new gfx::GLShareGroup),
+ mailbox_manager_(new gpu::gles2::MailboxManager),
watchdog_(watchdog),
software_(software),
handle_messages_scheduled_(false),
@@ -192,6 +194,7 @@ void GpuChannel::CreateViewCommandBuffer(
this,
share_group,
window,
+ mailbox_manager_,
gfx::Size(),
disallowed_features_,
init_params.allowed_extensions,
@@ -349,6 +352,7 @@ void GpuChannel::OnCreateOffscreenCommandBuffer(
this,
share_group,
gfx::GLSurfaceHandle(),
+ mailbox_manager_.get(),
size,
disallowed_features_,
init_params.allowed_extensions,
diff --git a/content/common/gpu/gpu_channel.h b/content/common/gpu/gpu_channel.h
index 42e4d8b..67d856e 100644
--- a/content/common/gpu/gpu_channel.h
+++ b/content/common/gpu/gpu_channel.h
@@ -156,6 +156,8 @@ class GpuChannel : public IPC::Channel::Listener,
// process use.
scoped_refptr<gfx::GLShareGroup> share_group_;
+ scoped_refptr<gpu::gles2::MailboxManager> mailbox_manager_;
+
#if defined(ENABLE_GPU)
typedef IDMap<GpuCommandBufferStub, IDMapOwnPointer> StubMap;
StubMap stubs_;
diff --git a/content/common/gpu/gpu_command_buffer_stub.cc b/content/common/gpu/gpu_command_buffer_stub.cc
index b6f6d28..aa5b331 100644
--- a/content/common/gpu/gpu_command_buffer_stub.cc
+++ b/content/common/gpu/gpu_command_buffer_stub.cc
@@ -39,6 +39,7 @@ GpuCommandBufferStub::GpuCommandBufferStub(
GpuChannel* channel,
GpuCommandBufferStub* share_group,
const gfx::GLSurfaceHandle& handle,
+ gpu::gles2::MailboxManager* mailbox_manager,
const gfx::Size& size,
const gpu::gles2::DisallowedFeatures& disallowed_features,
const std::string& allowed_extensions,
@@ -65,7 +66,7 @@ GpuCommandBufferStub::GpuCommandBufferStub(
if (share_group) {
context_group_ = share_group->context_group_;
} else {
- context_group_ = new gpu::gles2::ContextGroup(true);
+ context_group_ = new gpu::gles2::ContextGroup(mailbox_manager, true);
}
if (surface_id != 0)
surface_state_.reset(new GpuCommandBufferStubBase::SurfaceState(
diff --git a/content/common/gpu/gpu_command_buffer_stub.h b/content/common/gpu/gpu_command_buffer_stub.h
index 4f08818..5a99c56 100644
--- a/content/common/gpu/gpu_command_buffer_stub.h
+++ b/content/common/gpu/gpu_command_buffer_stub.h
@@ -39,6 +39,12 @@ class GpuChannel;
struct GpuMemoryAllocation;
class GpuWatchdog;
+namespace gpu {
+namespace gles2 {
+class MailboxManager;
+}
+}
+
// This Base class is used to expose methods of GpuCommandBufferStub used for
// testability.
class CONTENT_EXPORT GpuCommandBufferStubBase {
@@ -88,6 +94,7 @@ class GpuCommandBufferStub
GpuChannel* channel,
GpuCommandBufferStub* share_group,
const gfx::GLSurfaceHandle& handle,
+ gpu::gles2::MailboxManager* mailbox_manager,
const gfx::Size& size,
const gpu::gles2::DisallowedFeatures& disallowed_features,
const std::string& allowed_extensions,