diff options
author | apatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-01 21:50:59 +0000 |
---|---|---|
committer | apatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-01 21:50:59 +0000 |
commit | 78b514be30c67dad84bb8e2b6dfac3cfb15c79ff (patch) | |
tree | dd7d62dafa82bd6fbe087fb6f4de8148939c34ee /gpu/command_buffer/service/context_group.h | |
parent | 107d6e00cece1fb1545f5403193576f822e93a09 (diff) | |
download | chromium_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 'gpu/command_buffer/service/context_group.h')
-rw-r--r-- | gpu/command_buffer/service/context_group.h | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/gpu/command_buffer/service/context_group.h b/gpu/command_buffer/service/context_group.h index 5284c1c..8c5477e 100644 --- a/gpu/command_buffer/service/context_group.h +++ b/gpu/command_buffer/service/context_group.h @@ -22,9 +22,10 @@ class IdAllocatorInterface; namespace gles2 { -class GLES2Decoder; class BufferManager; +class GLES2Decoder; class FramebufferManager; +class MailboxManager; class RenderbufferManager; class ProgramManager; class ShaderManager; @@ -37,7 +38,8 @@ class GPU_EXPORT ContextGroup : public base::RefCounted<ContextGroup> { public: typedef scoped_refptr<ContextGroup> Ref; - explicit ContextGroup(bool bind_generates_resource); + explicit ContextGroup(MailboxManager* mailbox_manager, + bool bind_generates_resource); ~ContextGroup(); // This should only be called by GLES2Decoder. This must be paired with a @@ -49,6 +51,10 @@ class GPU_EXPORT ContextGroup : public base::RefCounted<ContextGroup> { // It should only be called by GLES2Decoder. void Destroy(bool have_context); + MailboxManager* mailbox_manager() const { + return mailbox_manager_.get(); + } + bool bind_generates_resource() { return bind_generates_resource_; } @@ -117,6 +123,8 @@ class GPU_EXPORT ContextGroup : public base::RefCounted<ContextGroup> { bool QueryGLFeature(GLenum pname, GLint min_required, GLint* v); bool QueryGLFeatureU(GLenum pname, GLint min_required, uint32* v); + scoped_refptr<MailboxManager> mailbox_manager_; + // Whether or not this context is initialized. int num_contexts_; bool enforce_gl_minimums_; |