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

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

Issue 238933003: Re-land: gpu: Add CHROMIUM_sync_query extension. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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
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 016bfab76b7aee824b029569fa88cf528fb0d3fa..b54e2e4fb4fee35ec0084c03af1ccf9d3e8cd875 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc
@@ -7112,6 +7112,7 @@ const QueryType kQueryTypes[] = {
{ GL_ASYNC_PIXEL_UNPACK_COMPLETED_CHROMIUM, false },
{ GL_ASYNC_PIXEL_PACK_COMPLETED_CHROMIUM, false },
{ GL_GET_ERROR_QUERY_CHROMIUM, false },
+ { GL_COMMANDS_COMPLETED_CHROMIUM, false },
{ GL_ANY_SAMPLES_PASSED_EXT, true },
};
@@ -7160,6 +7161,9 @@ static void CheckBeginEndQueryBadMemoryFails(
.WillOnce(Return(GL_NO_ERROR))
.RetiresOnSaturation();
}
+ if (query_type.type == GL_COMMANDS_COMPLETED_CHROMIUM) {
+ EXPECT_CALL(*gl, Finish()).Times(1).RetiresOnSaturation();
+ }
EndQueryEXT end_cmd;
end_cmd.Init(query_type.type, 1);
@@ -7276,6 +7280,64 @@ TEST_F(GLES2DecoderTest, BeginEndQueryEXTGetErrorQueryCHROMIUM) {
static_cast<GLenum>(sync->result));
}
+TEST_F(GLES2DecoderManualInitTest, BeginEndQueryEXTCommandsCompletedCHROMIUM) {
+ InitState init;
+ init.extensions = "GL_ARB_sync";
+ init.gl_version = "opengl es 2.0";
+ init.has_alpha = true;
+ init.request_alpha = true;
+ init.bind_generates_resource = true;
+ InitDecoder(init);
+
+ GenHelper<GenQueriesEXTImmediate>(kNewClientId);
+
+ BeginQueryEXT begin_cmd;
+ begin_cmd.Init(GL_COMMANDS_COMPLETED_CHROMIUM,
+ kNewClientId,
+ kSharedMemoryId,
+ kSharedMemoryOffset);
+ EXPECT_EQ(error::kNoError, ExecuteCmd(begin_cmd));
+ EXPECT_EQ(GL_NO_ERROR, GetGLError());
+
+ QueryManager* query_manager = decoder_->GetQueryManager();
+ ASSERT_TRUE(query_manager != NULL);
+ QueryManager::Query* query = query_manager->GetQuery(kNewClientId);
+ ASSERT_TRUE(query != NULL);
+ EXPECT_FALSE(query->pending());
+
+ GLsync gl_sync = reinterpret_cast<GLsync>(0xdeadbeef);
no sievers 2014/04/15 18:41:15 nit: const GLsync kGLSync = ...
reveman 2014/04/15 22:29:28 Done.
+ EXPECT_CALL(*gl_, FenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0))
+ .WillOnce(Return(gl_sync))
+ .RetiresOnSaturation();
no sievers 2014/04/15 18:41:15 no glFlush() expected?
reveman 2014/04/15 22:29:28 I was hoping we wouldn't need an implicit flush. T
+
+ EndQueryEXT end_cmd;
+ end_cmd.Init(GL_COMMANDS_COMPLETED_CHROMIUM, 1);
+ EXPECT_EQ(error::kNoError, ExecuteCmd(end_cmd));
+ EXPECT_EQ(GL_NO_ERROR, GetGLError());
+ EXPECT_TRUE(query->pending());
+
+ EXPECT_CALL(*gl_, GetSynciv(gl_sync, GL_SYNC_STATUS, 1, _, _))
+ .WillOnce(SetArgumentPointee<4>(GL_UNSIGNALED))
+ .RetiresOnSaturation();
+ bool process_success = query_manager->ProcessPendingQueries();
+
+ EXPECT_TRUE(process_success);
+ EXPECT_TRUE(query->pending());
+
+ EXPECT_CALL(*gl_, GetSynciv(gl_sync, GL_SYNC_STATUS, 1, _, _))
+ .WillOnce(SetArgumentPointee<4>(GL_SIGNALED))
+ .RetiresOnSaturation();
+ process_success = query_manager->ProcessPendingQueries();
+
+ EXPECT_TRUE(process_success);
+ EXPECT_FALSE(query->pending());
+ QuerySync* sync = static_cast<QuerySync*>(shared_memory_address_);
+ EXPECT_EQ(static_cast<GLenum>(0), static_cast<GLenum>(sync->result));
+
+ EXPECT_CALL(*gl_, DeleteSync(gl_sync)).Times(1).RetiresOnSaturation();
+ ResetDecoder();
+}
+
TEST_F(GLES2DecoderTest, ProduceAndConsumeTextureCHROMIUM) {
Mailbox mailbox = Mailbox::Generate();

Powered by Google App Engine
This is Rietveld 408576698