summaryrefslogtreecommitdiffstats
path: root/gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc
diff options
context:
space:
mode:
authordyen <dyen@chromium.org>2015-06-30 01:49:57 -0700
committerCommit bot <commit-bot@chromium.org>2015-06-30 08:50:37 +0000
commit1b6a2940fcb25df247b9f8b795e84e1ca5742904 (patch)
tree81d5feb7c487619f85c7784cf689cb8be3115e3b /gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc
parenta8a2de415f6597088f4a2f1e8610b5133c177cfd (diff)
downloadchromium_src-1b6a2940fcb25df247b9f8b795e84e1ca5742904.zip
chromium_src-1b6a2940fcb25df247b9f8b795e84e1ca5742904.tar.gz
chromium_src-1b6a2940fcb25df247b9f8b795e84e1ca5742904.tar.bz2
Added support for Time Elapsed queries through the command buffer.
This CL adds support for Time Elapsed queries through the command buffer. Since it was easy to support, I have also added support for getting the current TimeStamp through GetInteger64(), GetInteger()...etc. Note that this is different from getting the GPU timestamp using QueryCounter which is asynchronous. BUG=345227 TEST=trybots Review URL: https://codereview.chromium.org/1188013004 Cr-Commit-Position: refs/heads/master@{#336743}
Diffstat (limited to 'gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc')
-rw-r--r--gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc36
1 files changed, 20 insertions, 16 deletions
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc b/gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc
index 0201cf3..833a447 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc
@@ -573,6 +573,7 @@ const QueryType kQueryTypes[] = {
{GL_GET_ERROR_QUERY_CHROMIUM, false},
{GL_COMMANDS_COMPLETED_CHROMIUM, false},
{GL_ANY_SAMPLES_PASSED_EXT, true},
+ {GL_TIME_ELAPSED, true},
};
static void CheckBeginEndQueryBadMemoryFails(GLES2DecoderTestBase* test,
@@ -584,7 +585,9 @@ static void CheckBeginEndQueryBadMemoryFails(GLES2DecoderTestBase* test,
// We need to reset the decoder on each iteration, because we lose the
// context every time.
GLES2DecoderTestBase::InitState init;
- init.extensions = "GL_EXT_occlusion_query_boolean GL_ARB_sync";
+ init.extensions = "GL_EXT_occlusion_query_boolean"
+ " GL_ARB_sync"
+ " GL_ARB_timer_query";
init.gl_version = "opengl es 2.0";
init.has_alpha = true;
init.request_alpha = true;
@@ -641,9 +644,16 @@ static void CheckBeginEndQueryBadMemoryFails(GLES2DecoderTestBase* test,
*gl, GetQueryObjectuiv(service_id, GL_QUERY_RESULT_AVAILABLE_EXT, _))
.WillOnce(SetArgPointee<2>(1))
.RetiresOnSaturation();
- EXPECT_CALL(*gl, GetQueryObjectuiv(service_id, GL_QUERY_RESULT_EXT, _))
- .WillOnce(SetArgPointee<2>(1))
- .RetiresOnSaturation();
+ if (query_type.type == GL_TIME_ELAPSED) {
+ EXPECT_CALL(*gl, GetQueryObjectui64v(service_id, GL_QUERY_RESULT_EXT, _))
+ .WillOnce(SetArgPointee<2>(1))
+ .RetiresOnSaturation();
+ } else {
+ EXPECT_CALL(*gl, GetQueryObjectuiv(service_id, GL_QUERY_RESULT_EXT, _))
+ .WillOnce(SetArgPointee<2>(1))
+ .RetiresOnSaturation();
+ }
+ EXPECT_CALL(*gl, DeleteQueries(1, _)).Times(1).RetiresOnSaturation();
}
if (query_type.type == GL_COMMANDS_COMPLETED_CHROMIUM) {
#if DCHECK_IS_ON()
@@ -654,6 +664,12 @@ static void CheckBeginEndQueryBadMemoryFails(GLES2DecoderTestBase* test,
EXPECT_CALL(*gl, ClientWaitSync(kGlSync, _, _))
.WillOnce(Return(GL_ALREADY_SIGNALED))
.RetiresOnSaturation();
+#if DCHECK_IS_ON()
+ EXPECT_CALL(*gl, IsSync(kGlSync))
+ .WillOnce(Return(GL_TRUE))
+ .RetiresOnSaturation();
+#endif
+ EXPECT_CALL(*gl, DeleteSync(kGlSync)).Times(1).RetiresOnSaturation();
}
QueryManager* query_manager = test->GetDecoder()->GetQueryManager();
@@ -662,18 +678,6 @@ static void CheckBeginEndQueryBadMemoryFails(GLES2DecoderTestBase* test,
EXPECT_TRUE(error1 != error::kNoError || error2 != error::kNoError ||
!process_success);
-
- if (query_type.is_gl) {
- EXPECT_CALL(*gl, DeleteQueries(1, _)).Times(1).RetiresOnSaturation();
- }
- if (query_type.type == GL_COMMANDS_COMPLETED_CHROMIUM) {
-#if DCHECK_IS_ON()
- EXPECT_CALL(*gl, IsSync(kGlSync))
- .WillOnce(Return(GL_TRUE))
- .RetiresOnSaturation();
-#endif
- EXPECT_CALL(*gl, DeleteSync(kGlSync)).Times(1).RetiresOnSaturation();
- }
test->ResetDecoder();
}