Index: gpu/command_buffer/service/gles2_cmd_decoder.cc |
=================================================================== |
--- gpu/command_buffer/service/gles2_cmd_decoder.cc (revision 132415) |
+++ gpu/command_buffer/service/gles2_cmd_decoder.cc (working copy) |
@@ -30,6 +30,7 @@ |
#include "gpu/command_buffer/service/buffer_manager.h" |
#include "gpu/command_buffer/service/cmd_buffer_engine.h" |
#include "gpu/command_buffer/service/context_group.h" |
+#include "gpu/command_buffer/service/display.h" |
#include "gpu/command_buffer/service/feature_info.h" |
#include "gpu/command_buffer/service/framebuffer_manager.h" |
#include "gpu/command_buffer/service/gl_utils.h" |
@@ -42,6 +43,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" |
@@ -507,6 +509,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(); |
@@ -734,6 +739,12 @@ |
GLsizei width, |
GLsizei height); |
+ // Wrapper for SwapTexturesCHROMIUM. |
Ken Russell (switch to Gerrit)
2012/04/23 20:12:00
Comment out of date? And below?
|
+ void DoProduceTextureCHROMIUM(GLenum target, const GLint* key); |
+ |
+ // Wrapper for TexKeyCHROMIUM. |
+ void DoConsumeTextureCHROMIUM(GLenum target, const GLint* key); |
+ |
// Creates a ProgramInfo for the given program. |
ProgramManager::ProgramInfo* CreateProgramInfo( |
GLuint client_id, GLuint service_id) { |
@@ -3204,6 +3215,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() : |
@@ -8306,6 +8326,58 @@ |
} |
} |
+void GLES2DecoderImpl::DoProduceTextureCHROMIUM(GLenum target, |
+ const GLint* 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; |
+ } |
+ |
+ group_->display()->ProduceTexture( |
+ target, |
+ *reinterpret_cast<const MailboxName*>(mailbox), |
+ definition, |
+ texture_manager()); |
+ |
+ BindAndApplyTextureParameters(info); |
+} |
+ |
+void GLES2DecoderImpl::DoConsumeTextureCHROMIUM(GLenum target, |
+ const GLint* mailbox) { |
+ TextureManager::TextureInfo* info = GetTextureInfoForTarget(target); |
+ if (!info) { |
+ SetGLError(GL_INVALID_OPERATION, |
+ "glConsumeTextureCHROMIUM: unknown texture for target"); |
+ return; |
+ } |
+ |
+ scoped_ptr<TextureDefinition> definition(group_->display()->ConsumeTexture( |
+ target, |
+ *reinterpret_cast<const MailboxName*>(mailbox))); |
+ if (!definition.get()) { |
+ SetGLError(GL_INVALID_OPERATION, |
+ "glConsumeTextureCHROMIUM: empty mailbox"); |
+ 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. |