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

Unified Diff: gpu/command_buffer/client/query_tracker_unittest.cc

Issue 228653004: Reduce the number of flushes while using glQueries. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressing comment. Created 6 years, 8 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/client/query_tracker.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/command_buffer/client/query_tracker_unittest.cc
diff --git a/gpu/command_buffer/client/query_tracker_unittest.cc b/gpu/command_buffer/client/query_tracker_unittest.cc
index 0820a994cd3632baed84dcbc0fc54674b0ebed47..cd2ccf63297b37e7e3e392ef9d255de14e6d3b4f 100644
--- a/gpu/command_buffer/client/query_tracker_unittest.cc
+++ b/gpu/command_buffer/client/query_tracker_unittest.cc
@@ -107,6 +107,8 @@ class QueryTrackerTest : public testing::Test {
return query->info_.bucket;
}
+ uint32 GetFlushGeneration() { return helper_->flush_generation(); }
+
scoped_ptr<CommandBuffer> command_buffer_;
scoped_ptr<GLES2CmdHelper> helper_;
scoped_ptr<MappedMemoryManager> mapped_memory_;
@@ -164,6 +166,27 @@ TEST_F(QueryTrackerTest, Query) {
EXPECT_FALSE(query->NeverUsed());
EXPECT_TRUE(query->Pending());
+ // Flush only once if no more flushes happened between a call to
+ // EndQuery command and CheckResultsAvailable
+ // Advance put_ so flush calls in CheckResultsAvailable go through
+ // and updates flush_generation count
+ helper_->Noop(1);
+ // Set Query in pending state_ to simulate EndQuery command is called
+ query->MarkAsPending(kToken);
+ EXPECT_TRUE(query->Pending());
+ // Store FlushGeneration count after EndQuery is called
+ uint32 gen1 = GetFlushGeneration();
+ EXPECT_FALSE(query->CheckResultsAvailable(helper_.get()));
+ uint32 gen2 = GetFlushGeneration();
+ EXPECT_NE(gen1, gen2);
+ // Repeated calls to CheckResultsAvailable should not flush unnecessarily
+ EXPECT_FALSE(query->CheckResultsAvailable(helper_.get()));
+ gen1 = GetFlushGeneration();
+ EXPECT_EQ(gen1, gen2);
+ EXPECT_FALSE(query->CheckResultsAvailable(helper_.get()));
+ gen1 = GetFlushGeneration();
+ EXPECT_EQ(gen1, gen2);
+
// Simulate GPU process marking it as available.
QuerySync* sync = GetSync(query);
sync->process_count = query->submit_count();
« no previous file with comments | « gpu/command_buffer/client/query_tracker.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698