Commit 6b13d3ea authored by backer@chromium.org's avatar backer@chromium.org

Aura: A little lighter GL synchronization

On the consumeTextureCHROMIUM(), we only need to synchronize on the channel. This can be accomplished with a shallowFlushCHROMIUM() rather than a flush(), the latter which implies a service side glFlush().

BUG=none
TEST=by hand

Review URL: https://chromiumcodereview.appspot.com/11779023

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@175796 0039d316-1c4b-4281-b951-d872f2087c98
parent 12bddbd9
...@@ -171,7 +171,7 @@ class ImageTransportClientTexture : public OwnedTexture { ...@@ -171,7 +171,7 @@ class ImageTransportClientTexture : public OwnedTexture {
GL_TEXTURE_2D, GL_TEXTURE_2D,
reinterpret_cast<const signed char*>(mailbox_name.c_str())); reinterpret_cast<const signed char*>(mailbox_name.c_str()));
size_ = new_size; size_ = new_size;
host_context_->flush(); host_context_->shallowFlushCHROMIUM();
} }
virtual std::string Produce() OVERRIDE { virtual std::string Produce() OVERRIDE {
......
...@@ -41,13 +41,12 @@ New Procedures and Functions ...@@ -41,13 +41,12 @@ New Procedures and Functions
Moves the image data and parameters of the currently bound texture object Moves the image data and parameters of the currently bound texture object
into the mailbox. The texture object is redefined as though all its levels into the mailbox. The texture object is redefined as though all its levels
had been resized to zero by zero and the texture object is therefore had been resized to zero by zero and the texture object is therefore
incomplete. If the mailbox previously contained image data, the old image incomplete. The texture object parameters are undefined. The texture
data is deleted. The state of the bound texture object is not saved in the object is no longer immutable. If the mailbox previously contained image
mailbox, only the image data, as well as the immutable state. The texture data, the old image data is deleted.
object is no longer immutable.
If glProduceTextureCHROMIUM generates an error, the associated image data If glProduceTextureCHROMIUM generates an error, the associated image data
is preserved in the texture object. and state is preserved in the texture object.
The mailbox is emptied and the texture image data deleted if the context The mailbox is emptied and the texture image data deleted if the context
is destroyed before being consumed. See glConsumeTextureCHROMIUM. is destroyed before being consumed. See glConsumeTextureCHROMIUM.
......
...@@ -586,9 +586,6 @@ class GLES2DecoderImpl : public GLES2Decoder { ...@@ -586,9 +586,6 @@ class GLES2DecoderImpl : public GLES2Decoder {
// Sets DEPTH_TEST, STENCIL_TEST and color mask for the current framebuffer. // Sets DEPTH_TEST, STENCIL_TEST and color mask for the current framebuffer.
void ApplyDirtyState(); 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 // These check the state of the currently bound framebuffer or the
// backbuffer if no framebuffer is bound. // backbuffer if no framebuffer is bound.
bool BoundFramebufferHasColorAttachmentWithAlpha(); bool BoundFramebufferHasColorAttachmentWithAlpha();
...@@ -3564,15 +3561,6 @@ void GLES2DecoderImpl::ApplyDirtyState() { ...@@ -3564,15 +3561,6 @@ void GLES2DecoderImpl::ApplyDirtyState() {
} }
} }
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() const { GLuint GLES2DecoderImpl::GetBackbufferServiceId() const {
return (offscreen_target_frame_buffer_.get()) ? return (offscreen_target_frame_buffer_.get()) ?
offscreen_target_frame_buffer_->id() : offscreen_target_frame_buffer_->id() :
...@@ -9647,7 +9635,7 @@ void GLES2DecoderImpl::DoProduceTextureCHROMIUM(GLenum target, ...@@ -9647,7 +9635,7 @@ void GLES2DecoderImpl::DoProduceTextureCHROMIUM(GLenum target,
return; return;
} }
BindAndApplyTextureParameters(info); glBindTexture(info->target(), info->service_id());
} }
void GLES2DecoderImpl::DoConsumeTextureCHROMIUM(GLenum target, void GLES2DecoderImpl::DoConsumeTextureCHROMIUM(GLenum target,
...@@ -9675,7 +9663,7 @@ void GLES2DecoderImpl::DoConsumeTextureCHROMIUM(GLenum target, ...@@ -9675,7 +9663,7 @@ void GLES2DecoderImpl::DoConsumeTextureCHROMIUM(GLenum target,
return; return;
} }
BindAndApplyTextureParameters(info); glBindTexture(info->target(), info->service_id());
} }
void GLES2DecoderImpl::DoInsertEventMarkerEXT( void GLES2DecoderImpl::DoInsertEventMarkerEXT(
......
...@@ -7259,26 +7259,13 @@ TEST_F(GLES2DecoderTest, ProduceAndConsumeTextureCHROMIUM) { ...@@ -7259,26 +7259,13 @@ TEST_F(GLES2DecoderTest, ProduceAndConsumeTextureCHROMIUM) {
group().texture_manager()->GetTextureInfo(client_texture_id_); group().texture_manager()->GetTextureInfo(client_texture_id_);
EXPECT_EQ(kServiceTextureId, info->service_id()); EXPECT_EQ(kServiceTextureId, info->service_id());
// Assigns and binds new service side texture ID and applies the texture // Assigns and binds new service side texture ID.
// objects' state to it.
EXPECT_CALL(*gl_, GenTextures(1, _)) EXPECT_CALL(*gl_, GenTextures(1, _))
.WillOnce(SetArgumentPointee<1>(kNewServiceId)) .WillOnce(SetArgumentPointee<1>(kNewServiceId))
.RetiresOnSaturation(); .RetiresOnSaturation();
EXPECT_CALL(*gl_, BindTexture(GL_TEXTURE_2D, kNewServiceId)) EXPECT_CALL(*gl_, BindTexture(GL_TEXTURE_2D, kNewServiceId))
.Times(1) .Times(1)
.RetiresOnSaturation(); .RetiresOnSaturation();
EXPECT_CALL(*gl_, TexParameteri(GL_TEXTURE_2D,
GL_TEXTURE_MIN_FILTER,
GL_NEAREST_MIPMAP_LINEAR));
EXPECT_CALL(*gl_, TexParameteri(GL_TEXTURE_2D,
GL_TEXTURE_MAG_FILTER,
GL_LINEAR));
EXPECT_CALL(*gl_, TexParameteri(GL_TEXTURE_2D,
GL_TEXTURE_WRAP_S,
GL_REPEAT));
EXPECT_CALL(*gl_, TexParameteri(GL_TEXTURE_2D,
GL_TEXTURE_WRAP_T,
GL_REPEAT));
ProduceTextureCHROMIUM produce_cmd; ProduceTextureCHROMIUM produce_cmd;
produce_cmd.Init(GL_TEXTURE_2D, kSharedMemoryId, kSharedMemoryOffset); produce_cmd.Init(GL_TEXTURE_2D, kSharedMemoryId, kSharedMemoryOffset);
...@@ -7307,26 +7294,13 @@ TEST_F(GLES2DecoderTest, ProduceAndConsumeTextureCHROMIUM) { ...@@ -7307,26 +7294,13 @@ TEST_F(GLES2DecoderTest, ProduceAndConsumeTextureCHROMIUM) {
// Service ID has changed. // Service ID has changed.
EXPECT_EQ(kNewServiceId, info->service_id()); EXPECT_EQ(kNewServiceId, info->service_id());
// Assigns and binds original service side texture ID and applies the texture // Assigns and binds original service size texture ID.
// objects' state to it.
EXPECT_CALL(*gl_, DeleteTextures(1, _)) EXPECT_CALL(*gl_, DeleteTextures(1, _))
.Times(1) .Times(1)
.RetiresOnSaturation(); .RetiresOnSaturation();
EXPECT_CALL(*gl_, BindTexture(GL_TEXTURE_2D, kServiceTextureId)) EXPECT_CALL(*gl_, BindTexture(GL_TEXTURE_2D, kServiceTextureId))
.Times(1) .Times(1)
.RetiresOnSaturation(); .RetiresOnSaturation();
EXPECT_CALL(*gl_, TexParameteri(GL_TEXTURE_2D,
GL_TEXTURE_MIN_FILTER,
GL_NEAREST_MIPMAP_LINEAR));
EXPECT_CALL(*gl_, TexParameteri(GL_TEXTURE_2D,
GL_TEXTURE_MAG_FILTER,
GL_LINEAR));
EXPECT_CALL(*gl_, TexParameteri(GL_TEXTURE_2D,
GL_TEXTURE_WRAP_S,
GL_REPEAT));
EXPECT_CALL(*gl_, TexParameteri(GL_TEXTURE_2D,
GL_TEXTURE_WRAP_T,
GL_REPEAT));
ConsumeTextureCHROMIUM consume_cmd; ConsumeTextureCHROMIUM consume_cmd;
consume_cmd.Init(GL_TEXTURE_2D, kSharedMemoryId, kSharedMemoryOffset); consume_cmd.Init(GL_TEXTURE_2D, kSharedMemoryId, kSharedMemoryOffset);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment