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

Side by Side Diff: gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc

Issue 1233233002: Added support for TimeStamp queries using QueryCounterEXT. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed unit test Created 5 years, 5 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "gpu/command_buffer/service/gles2_cmd_decoder_unittest.h" 5 #include "gpu/command_buffer/service/gles2_cmd_decoder_unittest.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/strings/string_number_conversions.h" 8 #include "base/strings/string_number_conversions.h"
9 #include "gpu/command_buffer/common/gles2_cmd_format.h" 9 #include "gpu/command_buffer/common/gles2_cmd_format.h"
10 #include "gpu/command_buffer/common/gles2_cmd_utils.h" 10 #include "gpu/command_buffer/common/gles2_cmd_utils.h"
(...skipping 865 matching lines...) Expand 10 before | Expand all | Expand 10 after
876 EXPECT_EQ(error::kNoError, ExecuteCmd(begin_cmd)); 876 EXPECT_EQ(error::kNoError, ExecuteCmd(begin_cmd));
877 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); 877 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError());
878 878
879 begin_cmd.Init(GL_ANY_SAMPLES_PASSED_CONSERVATIVE, 879 begin_cmd.Init(GL_ANY_SAMPLES_PASSED_CONSERVATIVE,
880 kNewClientId, 880 kNewClientId,
881 kSharedMemoryId, 881 kSharedMemoryId,
882 kSharedMemoryOffset); 882 kSharedMemoryOffset);
883 EXPECT_EQ(error::kNoError, ExecuteCmd(begin_cmd)); 883 EXPECT_EQ(error::kNoError, ExecuteCmd(begin_cmd));
884 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); 884 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError());
885 885
886 begin_cmd.Init(GL_TIME_ELAPSED,
887 kNewClientId,
888 kSharedMemoryId,
889 kSharedMemoryOffset);
890 EXPECT_EQ(error::kNoError, ExecuteCmd(begin_cmd));
891 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError());
892
886 begin_cmd.Init(0xdeadbeef, 893 begin_cmd.Init(0xdeadbeef,
887 kNewClientId, 894 kNewClientId,
888 kSharedMemoryId, 895 kSharedMemoryId,
889 kSharedMemoryOffset); 896 kSharedMemoryOffset);
890 EXPECT_EQ(error::kNoError, ExecuteCmd(begin_cmd)); 897 EXPECT_EQ(error::kNoError, ExecuteCmd(begin_cmd));
898 EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
899 }
900
901 TEST_P(GLES2DecoderManualInitTest, QueryCounterEXTTimeStamp) {
902 InitState init;
903 init.extensions = "GL_ARB_timer_query";
904 init.gl_version = "opengl 2.0";
905 init.has_alpha = true;
906 init.request_alpha = true;
907 init.bind_generates_resource = true;
908 InitDecoder(init);
909
910 GenHelper<GenQueriesEXTImmediate>(kNewClientId);
911
912 EXPECT_CALL(*gl_, GenQueries(1, _))
913 .WillOnce(SetArgPointee<1>(kNewServiceId))
914 .RetiresOnSaturation();
915 EXPECT_CALL(*gl_, QueryCounter(kNewServiceId, GL_TIMESTAMP))
916 .Times(1)
917 .RetiresOnSaturation();
918 QueryCounterEXT query_counter_cmd;
919 query_counter_cmd.Init(kNewClientId,
920 GL_TIMESTAMP,
921 kSharedMemoryId,
922 kSharedMemoryOffset,
923 1);
924 EXPECT_EQ(error::kNoError, ExecuteCmd(query_counter_cmd));
925 EXPECT_EQ(GL_NO_ERROR, GetGLError());
926
927 QueryManager* query_manager = decoder_->GetQueryManager();
928 ASSERT_TRUE(query_manager != NULL);
929 QueryManager::Query* query = query_manager->GetQuery(kNewClientId);
930 ASSERT_TRUE(query != NULL);
931 EXPECT_TRUE(query->pending());
932 }
933
934 TEST_P(GLES2DecoderManualInitTest, InvalidTargetQueryCounterFails) {
935 InitState init;
936 init.extensions = "";
937 init.gl_version = "opengl es 2.0";
938 init.has_alpha = true;
939 init.request_alpha = true;
940 init.bind_generates_resource = true;
941 InitDecoder(init);
942
943 GenHelper<GenQueriesEXTImmediate>(kNewClientId);
944
945 QueryCounterEXT query_counter_cmd;
946 query_counter_cmd.Init(kNewClientId,
947 GL_TIMESTAMP,
948 kSharedMemoryId,
949 kSharedMemoryOffset,
950 1);
951 EXPECT_EQ(error::kNoError, ExecuteCmd(query_counter_cmd));
891 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); 952 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError());
953
954 query_counter_cmd.Init(kNewClientId,
955 0xdeadbeef,
956 kSharedMemoryId,
957 kSharedMemoryOffset,
958 1);
959 EXPECT_EQ(error::kNoError, ExecuteCmd(query_counter_cmd));
960 EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
892 } 961 }
893 962
894 TEST_P(GLES2DecoderTest, IsEnabledReturnsCachedValue) { 963 TEST_P(GLES2DecoderTest, IsEnabledReturnsCachedValue) {
895 // NOTE: There are no expectations because no GL functions should be 964 // NOTE: There are no expectations because no GL functions should be
896 // called for DEPTH_TEST or STENCIL_TEST 965 // called for DEPTH_TEST or STENCIL_TEST
897 static const GLenum kStates[] = { 966 static const GLenum kStates[] = {
898 GL_DEPTH_TEST, GL_STENCIL_TEST, 967 GL_DEPTH_TEST, GL_STENCIL_TEST,
899 }; 968 };
900 for (size_t ii = 0; ii < arraysize(kStates); ++ii) { 969 for (size_t ii = 0; ii < arraysize(kStates); ++ii) {
901 Enable enable_cmd; 970 Enable enable_cmd;
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after
1380 INSTANTIATE_TEST_CASE_P(Service, 1449 INSTANTIATE_TEST_CASE_P(Service,
1381 GLES2DecoderRGBBackbufferTest, 1450 GLES2DecoderRGBBackbufferTest,
1382 ::testing::Bool()); 1451 ::testing::Bool());
1383 1452
1384 INSTANTIATE_TEST_CASE_P(Service, GLES2DecoderDoCommandsTest, ::testing::Bool()); 1453 INSTANTIATE_TEST_CASE_P(Service, GLES2DecoderDoCommandsTest, ::testing::Bool());
1385 1454
1386 INSTANTIATE_TEST_CASE_P(Service, GLES3DecoderTest, ::testing::Bool()); 1455 INSTANTIATE_TEST_CASE_P(Service, GLES3DecoderTest, ::testing::Bool());
1387 1456
1388 } // namespace gles2 1457 } // namespace gles2
1389 } // namespace gpu 1458 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698