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

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

Issue 952893003: Update from https://crrev.com/317530 (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Fix gn for nacl Created 5 years, 10 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/mailbox_manager_sync.cc ('k') | gpu/command_buffer/service/shader_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/command_buffer/service/mailbox_manager_unittest.cc
diff --git a/gpu/command_buffer/service/mailbox_manager_unittest.cc b/gpu/command_buffer/service/mailbox_manager_unittest.cc
index 388e1da5a299a0bcce02dacf12a93a6b1a628f3e..a22078c2652c6518e87a9f482560318ae4c527e6 100644
--- a/gpu/command_buffer/service/mailbox_manager_unittest.cc
+++ b/gpu/command_buffer/service/mailbox_manager_unittest.cc
@@ -595,6 +595,66 @@ TEST_F(MailboxManagerSyncTest, ClearedStateSynced) {
EXPECT_EQ(NULL, manager2_->ConsumeTexture(name));
}
+TEST_F(MailboxManagerSyncTest, SyncIncompleteTexture) {
+ const GLuint kNewTextureId = 1234;
+
+ // Create but not define texture.
+ Texture* texture = CreateTexture();
+ SetTarget(texture, GL_TEXTURE_2D, 1);
+ EXPECT_FALSE(texture->IsDefined());
+
+ Mailbox name = Mailbox::Generate();
+ manager_->ProduceTexture(name, texture);
+ EXPECT_EQ(texture, manager_->ConsumeTexture(name));
+
+ // Synchronize
+ manager_->PushTextureUpdates(0);
+ manager2_->PullTextureUpdates(0);
+
+ // Should sync to new texture which is not defined.
+ EXPECT_CALL(*gl_, GenTextures(1, _))
+ .WillOnce(SetArgPointee<1>(kNewTextureId));
+ SetupUpdateTexParamExpectations(kNewTextureId, texture->min_filter(),
+ texture->mag_filter(), texture->wrap_s(),
+ texture->wrap_t());
+ Texture* new_texture = manager2_->ConsumeTexture(name);
+ ASSERT_TRUE(new_texture);
+ EXPECT_NE(texture, new_texture);
+ EXPECT_EQ(kNewTextureId, new_texture->service_id());
+ EXPECT_FALSE(new_texture->IsDefined());
+
+ // Change cleared to false.
+ SetLevelInfo(texture,
+ GL_TEXTURE_2D,
+ 0,
+ GL_RGBA,
+ 1,
+ 1,
+ 1,
+ 0,
+ GL_RGBA,
+ GL_UNSIGNED_BYTE,
+ true);
+ SetParameter(texture, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+ SetParameter(texture, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+ EXPECT_TRUE(texture->IsDefined());
+
+ // Synchronize
+ manager_->PushTextureUpdates(0);
+ SetupUpdateTexParamExpectations(
+ kNewTextureId, GL_LINEAR, GL_LINEAR, GL_REPEAT, GL_REPEAT);
+ manager2_->PullTextureUpdates(0);
+
+ // Cleared state should be synced.
+ EXPECT_TRUE(new_texture->IsDefined());
+
+ DestroyTexture(texture);
+ DestroyTexture(new_texture);
+
+ EXPECT_EQ(NULL, manager_->ConsumeTexture(name));
+ EXPECT_EQ(NULL, manager2_->ConsumeTexture(name));
+}
+
// Putting the same texture into multiple mailboxes should result in sharing
// only a single texture also within a synchronized manager instance.
TEST_F(MailboxManagerSyncTest, SharedThroughMultipleMailboxes) {
@@ -671,8 +731,6 @@ TEST_F(MailboxManagerSyncTest, ProduceBothWays) {
DestroyTexture(new_texture);
}
-// TODO: Produce incomplete texture
-
// TODO: Texture::level_infos_[][].size()
// TODO: unsupported targets and formats
« no previous file with comments | « gpu/command_buffer/service/mailbox_manager_sync.cc ('k') | gpu/command_buffer/service/shader_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698