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

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

Issue 10106015: Allow textures to be moved from one GL context group to another. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 8 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
« no previous file with comments | « gpu/command_buffer/service/feature_info.cc ('k') | gpu/command_buffer/service/gles2_cmd_decoder_autogen.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/command_buffer/service/gles2_cmd_decoder.cc
===================================================================
--- gpu/command_buffer/service/gles2_cmd_decoder.cc (revision 134729)
+++ gpu/command_buffer/service/gles2_cmd_decoder.cc (working copy)
@@ -36,6 +36,7 @@
#include "gpu/command_buffer/service/gles2_cmd_copy_texture_chromium.h"
#include "gpu/command_buffer/service/gles2_cmd_validation.h"
#include "gpu/command_buffer/service/gpu_switches.h"
+#include "gpu/command_buffer/service/mailbox_manager.h"
#include "gpu/command_buffer/service/program_manager.h"
#include "gpu/command_buffer/service/query_manager.h"
#include "gpu/command_buffer/service/renderbuffer_manager.h"
@@ -43,6 +44,7 @@
#include "gpu/command_buffer/service/shader_translator.h"
#include "gpu/command_buffer/service/stream_texture.h"
#include "gpu/command_buffer/service/stream_texture_manager.h"
+#include "gpu/command_buffer/service/texture_definition.h"
#include "gpu/command_buffer/service/texture_manager.h"
#include "gpu/command_buffer/service/vertex_attrib_manager.h"
#include "ui/gfx/gl/gl_context.h"
@@ -509,6 +511,9 @@
// Sets DEPTH_TEST, STENCIL_TEST and color mask for the current framebuffer.
void ApplyDirtyState();
+ // Reapply the texture parameters to the given texture.
+ void BindAndApplyTextureParameters(TextureManager::TextureInfo* info);
+
// These check the state of the currently bound framebuffer or the
// backbuffer if no framebuffer is bound.
bool BoundFramebufferHasColorAttachmentWithAlpha();
@@ -619,6 +624,10 @@
return group_->texture_manager();
}
+ MailboxManager* mailbox_manager() {
+ return group_->mailbox_manager();
+ }
+
bool IsOffscreenBufferMultisampled() const {
return offscreen_target_samples_ > 1;
}
@@ -742,6 +751,9 @@
GLsizei width,
GLsizei height);
+ void DoProduceTextureCHROMIUM(GLenum target, const GLbyte* key);
+ void DoConsumeTextureCHROMIUM(GLenum target, const GLbyte* key);
+
// Creates a ProgramInfo for the given program.
ProgramManager::ProgramInfo* CreateProgramInfo(
GLuint client_id, GLuint service_id) {
@@ -3265,6 +3277,15 @@
}
}
+void GLES2DecoderImpl::BindAndApplyTextureParameters(
+ TextureManager::TextureInfo* info) {
+ glBindTexture(info->target(), info->service_id());
+ glTexParameteri(info->target(), GL_TEXTURE_MIN_FILTER, info->min_filter());
+ glTexParameteri(info->target(), GL_TEXTURE_MAG_FILTER, info->mag_filter());
+ glTexParameteri(info->target(), GL_TEXTURE_WRAP_S, info->wrap_s());
+ glTexParameteri(info->target(), GL_TEXTURE_WRAP_T, info->wrap_t());
+}
+
GLuint GLES2DecoderImpl::GetBackbufferServiceId() {
return (offscreen_target_frame_buffer_.get()) ?
offscreen_target_frame_buffer_->id() :
@@ -8507,6 +8528,78 @@
}
}
+error::Error GLES2DecoderImpl::HandleGenMailboxCHROMIUM(
+ uint32 immediate_data_size, const gles2::GenMailboxCHROMIUM& c) {
+ MailboxName name;
+ mailbox_manager()->GenerateMailboxName(&name);
+ uint32 bucket_id = static_cast<uint32>(c.bucket_id);
+ Bucket* bucket = CreateBucket(bucket_id);
+
+ bucket->SetSize(GL_MAILBOX_SIZE_CHROMIUM);
+ bucket->SetData(&name, 0, GL_MAILBOX_SIZE_CHROMIUM);
+
+ return error::kNoError;
+}
+
+void GLES2DecoderImpl::DoProduceTextureCHROMIUM(GLenum target,
+ const GLbyte* mailbox) {
+ TextureManager::TextureInfo* info = GetTextureInfoForTarget(target);
+ if (!info) {
+ SetGLError(GL_INVALID_OPERATION,
+ "glProduceTextureCHROMIUM: unknown texture for target");
+ return;
+ }
+
+ TextureDefinition* definition = texture_manager()->Save(info);
+ if (!definition) {
+ SetGLError(GL_INVALID_OPERATION,
+ "glProduceTextureCHROMIUM: invalid texture");
+ return;
+ }
+
+ if (!group_->mailbox_manager()->ProduceTexture(
+ target,
+ *reinterpret_cast<const MailboxName*>(mailbox),
+ definition,
+ texture_manager())) {
+ bool success = texture_manager()->Restore(info, definition);
+ DCHECK(success);
+ SetGLError(GL_INVALID_OPERATION,
+ "glProduceTextureCHROMIUM: invalid mailbox name");
+ return;
+ }
+
+ BindAndApplyTextureParameters(info);
+}
+
+void GLES2DecoderImpl::DoConsumeTextureCHROMIUM(GLenum target,
+ const GLbyte* mailbox) {
+ TextureManager::TextureInfo* info = GetTextureInfoForTarget(target);
+ if (!info) {
+ SetGLError(GL_INVALID_OPERATION,
+ "glConsumeTextureCHROMIUM: unknown texture for target");
+ return;
+ }
+
+ scoped_ptr<TextureDefinition> definition(
+ group_->mailbox_manager()->ConsumeTexture(
+ target,
+ *reinterpret_cast<const MailboxName*>(mailbox)));
+ if (!definition.get()) {
+ SetGLError(GL_INVALID_OPERATION,
+ "glConsumeTextureCHROMIUM: invalid mailbox name");
+ return;
+ }
+
+ if (!texture_manager()->Restore(info, definition.release())) {
+ SetGLError(GL_INVALID_OPERATION,
+ "glConsumeTextureCHROMIUM: invalid texture");
+ return;
+ }
+
+ BindAndApplyTextureParameters(info);
+}
+
// Include the auto-generated part of this file. We split this because it means
// we can easily edit the non-auto generated parts right here in this file
// instead of having to edit some template or the code generator.
« no previous file with comments | « gpu/command_buffer/service/feature_info.cc ('k') | gpu/command_buffer/service/gles2_cmd_decoder_autogen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698