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

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

Issue 890453002: Correctly track texture cleared state when sharing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: c++11 Created 5 years, 11 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 | « no previous file | gpu/command_buffer/service/texture_definition.h » ('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 231193f19267183836b03935c27f5b61291bf379..388e1da5a299a0bcce02dacf12a93a6b1a628f3e 100644
--- a/gpu/command_buffer/service/mailbox_manager_unittest.cc
+++ b/gpu/command_buffer/service/mailbox_manager_unittest.cc
@@ -72,6 +72,13 @@ class MailboxManagerTest : public GpuServiceTest {
cleared);
}
+ void SetLevelCleared(Texture* texture,
+ GLenum target,
+ GLint level,
+ bool cleared) {
+ texture->SetLevelCleared(target, level, cleared);
+ }
+
GLenum SetParameter(Texture* texture, GLenum pname, GLint param) {
return texture->SetParameteri(feature_info_.get(), pname, param);
}
@@ -543,6 +550,51 @@ TEST_F(MailboxManagerSyncTest, ProduceAndClobber) {
EXPECT_EQ(NULL, manager2_->ConsumeTexture(name));
}
+TEST_F(MailboxManagerSyncTest, ClearedStateSynced) {
+ const GLuint kNewTextureId = 1234;
+
+ Texture* texture = DefineTexture();
+ EXPECT_TRUE(texture->SafeToRenderFrom());
+
+ Mailbox name = Mailbox::Generate();
+
+ manager_->ProduceTexture(name, texture);
+ EXPECT_EQ(texture, manager_->ConsumeTexture(name));
+
+ // Synchronize
+ manager_->PushTextureUpdates(0);
+ manager2_->PullTextureUpdates(0);
+
+ EXPECT_CALL(*gl_, GenTextures(1, _))
+ .WillOnce(SetArgPointee<1>(kNewTextureId));
+ SetupUpdateTexParamExpectations(
+ kNewTextureId, GL_LINEAR, GL_LINEAR, GL_REPEAT, GL_REPEAT);
+ Texture* new_texture = manager2_->ConsumeTexture(name);
+ EXPECT_FALSE(new_texture == NULL);
+ EXPECT_NE(texture, new_texture);
+ EXPECT_EQ(kNewTextureId, new_texture->service_id());
+ EXPECT_TRUE(texture->SafeToRenderFrom());
+
+ // Change cleared to false.
+ SetLevelCleared(texture, texture->target(), 0, false);
+ EXPECT_FALSE(texture->SafeToRenderFrom());
+
+ // Synchronize
+ manager_->PushTextureUpdates(0);
+ SetupUpdateTexParamExpectations(
+ kNewTextureId, GL_LINEAR, GL_LINEAR, GL_REPEAT, GL_REPEAT);
+ manager2_->PullTextureUpdates(0);
+
+ // Cleared state should be synced.
+ EXPECT_FALSE(new_texture->SafeToRenderFrom());
+
+ 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) {
« no previous file with comments | « no previous file | gpu/command_buffer/service/texture_definition.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698