| OLD | NEW |
| 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 <stddef.h> | 5 #include <stddef.h> |
| 6 #include <stdint.h> | 6 #include <stdint.h> |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "gpu/command_buffer/common/gles2_cmd_format.h" | 10 #include "gpu/command_buffer/common/gles2_cmd_format.h" |
| (...skipping 936 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 947 .RetiresOnSaturation(); | 947 .RetiresOnSaturation(); |
| 948 | 948 |
| 949 EXPECT_TRUE(manager->EndQuery(query, kSubmitCount)); | 949 EXPECT_TRUE(manager->EndQuery(query, kSubmitCount)); |
| 950 EXPECT_FALSE(query->IsPending()); | 950 EXPECT_FALSE(query->IsPending()); |
| 951 | 951 |
| 952 EXPECT_EQ(static_cast<GLuint>(GL_INVALID_ENUM), sync->result); | 952 EXPECT_EQ(static_cast<GLuint>(GL_INVALID_ENUM), sync->result); |
| 953 | 953 |
| 954 manager->Destroy(false); | 954 manager->Destroy(false); |
| 955 } | 955 } |
| 956 | 956 |
| 957 TEST_F(QueryManagerTest, OcclusionQuery) { |
| 958 const GLuint kClient1Id = 1; |
| 959 const GLuint kService1Id = 11; |
| 960 const GLenum kTarget = GL_SAMPLES_PASSED_ARB; |
| 961 const base::subtle::Atomic32 kSubmitCount = 123; |
| 962 |
| 963 TestHelper::SetupFeatureInfoInitExpectations( |
| 964 gl_.get(), |
| 965 "GL_ARB_occlusion_query"); |
| 966 scoped_refptr<FeatureInfo> feature_info(new FeatureInfo()); |
| 967 feature_info->InitializeForTesting(); |
| 968 std::unique_ptr<QueryManager> manager( |
| 969 new QueryManager(decoder_.get(), feature_info.get())); |
| 970 |
| 971 EXPECT_CALL(*gl_, GenQueries(1, _)) |
| 972 .WillOnce(SetArgumentPointee<1>(kService1Id)) |
| 973 .RetiresOnSaturation(); |
| 974 QueryManager::Query* query = manager->CreateQuery( |
| 975 kTarget, kClient1Id, kSharedMemoryId, kSharedMemoryOffset); |
| 976 ASSERT_TRUE(query != NULL); |
| 977 |
| 978 EXPECT_CALL(*gl_, BeginQuery(GL_SAMPLES_PASSED_ARB, kService1Id)) |
| 979 .Times(1) |
| 980 .RetiresOnSaturation(); |
| 981 EXPECT_CALL(*gl_, EndQuery(GL_SAMPLES_PASSED_ARB)) |
| 982 .Times(1) |
| 983 .RetiresOnSaturation(); |
| 984 EXPECT_TRUE(manager->BeginQuery(query)); |
| 985 EXPECT_TRUE(manager->EndQuery(query, kSubmitCount)); |
| 986 manager->Destroy(false); |
| 987 } |
| 988 |
| 957 } // namespace gles2 | 989 } // namespace gles2 |
| 958 } // namespace gpu | 990 } // namespace gpu |
| 959 | 991 |
| 960 | 992 |
| OLD | NEW |