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

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

Issue 116863003: gpu: Reuse transfer buffers more aggresively (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fixed bug in unittest Created 6 years, 9 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
Index: gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc b/gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc
index 15fd1d1278575196f048ccf2c202096a6ae59486..2786f88407450916dfaafeb0a095249e2563057a 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc
@@ -8223,12 +8223,16 @@ TEST_F(GLES2DecoderManualInitTest, AsyncPixelTransfers) {
// Tex(Sub)Image2D upload commands.
AsyncTexImage2DCHROMIUM teximage_cmd;
teximage_cmd.Init(GL_TEXTURE_2D, 0, GL_RGBA, 8, 8, 0, GL_RGBA,
- GL_UNSIGNED_BYTE, kSharedMemoryId, kSharedMemoryOffset);
+ GL_UNSIGNED_BYTE, kSharedMemoryId, kSharedMemoryOffset,
+ 0, 0, 0);
AsyncTexSubImage2DCHROMIUM texsubimage_cmd;
texsubimage_cmd.Init(GL_TEXTURE_2D, 0, 0, 0, 8, 8, GL_RGBA,
- GL_UNSIGNED_BYTE, kSharedMemoryId, kSharedMemoryOffset);
+ GL_UNSIGNED_BYTE, kSharedMemoryId, kSharedMemoryOffset,
+ 0, 0, 0);
WaitAsyncTexImage2DCHROMIUM wait_cmd;
wait_cmd.Init(GL_TEXTURE_2D);
+ WaitAllAsyncTexImage2DCHROMIUM wait_all_cmd;
+ wait_all_cmd.Init();
// No transfer state exists initially.
EXPECT_FALSE(
@@ -8360,7 +8364,7 @@ TEST_F(GLES2DecoderManualInitTest, AsyncPixelTransfers) {
// WaitAsyncTexImage2D
{
// Get a fresh texture since the existing texture cannot be respecified
- // asynchronously and AsyncTexSubImage2D does not involved binding.
+ // asynchronously and AsyncTexSubImage2D does not involve binding.
EXPECT_CALL(*gl_, GenTextures(1, _))
.WillOnce(SetArgumentPointee<1>(kServiceTextureId));
DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId);
@@ -8389,6 +8393,45 @@ TEST_F(GLES2DecoderManualInitTest, AsyncPixelTransfers) {
EXPECT_EQ(error::kNoError, ExecuteCmd(wait_cmd));
EXPECT_EQ(GL_NO_ERROR, GetGLError());
}
+
+ // WaitAllAsyncTexImage2D
+ EXPECT_CALL(*delegate, Destroy()).RetiresOnSaturation();
+ DoDeleteTexture(client_texture_id_, kServiceTextureId);
+ EXPECT_FALSE(
+ decoder_->GetAsyncPixelTransferManager()->GetPixelTransferDelegate(
+ texture_ref));
piman 2014/03/28 20:04:35 nit: actually, texture_ref should probably be a sc
jadahl 2014/03/28 20:11:38 Do you want that change in this patch? It'll chang
piman 2014/03/28 20:22:49 Either that or add a comment to indicate that text
jadahl 2014/03/28 20:25:00 Tests also assume no reference is held, and fail b
+ delegate = NULL;
+ {
+ // Get a fresh texture since the existing texture cannot be respecified
+ // asynchronously and AsyncTexSubImage2D does not involve binding.
+ EXPECT_CALL(*gl_, GenTextures(1, _))
+ .WillOnce(SetArgumentPointee<1>(kServiceTextureId));
+ DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId);
+ texture_ref = GetTexture(client_texture_id_);
+ texture = texture_ref->texture();
+ texture->SetImmutable(false);
+ // Create transfer state since it doesn't exist.
+ EXPECT_CALL(*manager, CreatePixelTransferDelegateImpl(texture_ref, _))
+ .WillOnce(Return(
+ delegate = new StrictMock<gpu::MockAsyncPixelTransferDelegate>))
+ .RetiresOnSaturation();
+ EXPECT_CALL(*delegate, AsyncTexImage2D(_, _, _))
+ .RetiresOnSaturation();
+ // Start async transfer.
+ EXPECT_EQ(error::kNoError, ExecuteCmd(teximage_cmd));
+ EXPECT_EQ(GL_NO_ERROR, GetGLError());
+ EXPECT_EQ(
+ delegate,
+ decoder_->GetAsyncPixelTransferManager()->GetPixelTransferDelegate(
+ texture_ref));
+
+ EXPECT_TRUE(texture->IsImmutable());
+ // Wait for completion of all uploads.
+ EXPECT_CALL(*manager, WaitAllAsyncTexImage2D()).RetiresOnSaturation();
+ EXPECT_CALL(*manager, BindCompletedAsyncTransfers());
+ EXPECT_EQ(error::kNoError, ExecuteCmd(wait_all_cmd));
+ EXPECT_EQ(GL_NO_ERROR, GetGLError());
+ }
}
TEST_F(GLES2DecoderManualInitTest, AsyncPixelTransferManager) {
@@ -8412,7 +8455,8 @@ TEST_F(GLES2DecoderManualInitTest, AsyncPixelTransferManager) {
AsyncTexImage2DCHROMIUM teximage_cmd;
teximage_cmd.Init(GL_TEXTURE_2D, 0, GL_RGBA, 8, 8, 0, GL_RGBA,
- GL_UNSIGNED_BYTE, kSharedMemoryId, kSharedMemoryOffset);
+ GL_UNSIGNED_BYTE, kSharedMemoryId, kSharedMemoryOffset,
+ 0, 0, 0);
// No transfer delegate exists initially.
EXPECT_FALSE(
« no previous file with comments | « gpu/command_buffer/service/gles2_cmd_decoder.cc ('k') | gpu/command_buffer/service/gles2_cmd_decoder_unittest_3_autogen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698