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

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: Rebased; removed unnecessary barrier; use CheckedNumeric 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..8d0989fe287d5fc18b9c07816bffe8e3ff8353fa 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(
@@ -8389,6 +8393,46 @@ 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));
+ texture->SetImmutable(false);
+ delegate = NULL;
+ {
+ // Get a fresh texture since the existing texture cannot be respecified
+ // asynchronously and AsyncTexSubImage2D does not involved binding.
piman 2014/03/21 22:35:51 nit: typo involved->involves
jadahl 2014/03/24 10:09:54 Hmm, isn't "involve" more correct? Changed to that
+ 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 +8456,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