| 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 "gpu/command_buffer/service/query_manager.h" | 5 #include "gpu/command_buffer/service/query_manager.h" |
| 6 #include "gpu/command_buffer/common/gles2_cmd_format.h" | 6 #include "gpu/command_buffer/common/gles2_cmd_format.h" |
| 7 #include "gpu/command_buffer/service/cmd_buffer_engine.h" | 7 #include "gpu/command_buffer/service/cmd_buffer_engine.h" |
| 8 #include "gpu/command_buffer/service/error_state_mock.h" | 8 #include "gpu/command_buffer/service/error_state_mock.h" |
| 9 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" | 9 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" |
| 10 #include "gpu/command_buffer/service/gles2_cmd_decoder_mock.h" | 10 #include "gpu/command_buffer/service/gles2_cmd_decoder_mock.h" |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 | 62 |
| 63 QueryManager::Query* CreateQuery( | 63 QueryManager::Query* CreateQuery( |
| 64 GLenum target, GLuint client_id, int32 shm_id, uint32 shm_offset, | 64 GLenum target, GLuint client_id, int32 shm_id, uint32 shm_offset, |
| 65 GLuint service_id) { | 65 GLuint service_id) { |
| 66 EXPECT_CALL(*gl_, GenQueriesARB(1, _)) | 66 EXPECT_CALL(*gl_, GenQueriesARB(1, _)) |
| 67 .WillOnce(SetArgumentPointee<1>(service_id)) | 67 .WillOnce(SetArgumentPointee<1>(service_id)) |
| 68 .RetiresOnSaturation(); | 68 .RetiresOnSaturation(); |
| 69 return manager_->CreateQuery(target, client_id, shm_id, shm_offset); | 69 return manager_->CreateQuery(target, client_id, shm_id, shm_offset); |
| 70 } | 70 } |
| 71 | 71 |
| 72 void QueueQuery( | 72 void QueueQuery(QueryManager::Query* query, |
| 73 QueryManager::Query* query, GLuint service_id, uint32 submit_count) { | 73 GLuint service_id, |
| 74 base::subtle::Atomic32 submit_count) { |
| 74 EXPECT_CALL(*gl_, BeginQueryARB(query->target(), service_id)) | 75 EXPECT_CALL(*gl_, BeginQueryARB(query->target(), service_id)) |
| 75 .Times(1) | 76 .Times(1) |
| 76 .RetiresOnSaturation(); | 77 .RetiresOnSaturation(); |
| 77 EXPECT_CALL(*gl_, EndQueryARB(query->target())) | 78 EXPECT_CALL(*gl_, EndQueryARB(query->target())) |
| 78 .Times(1) | 79 .Times(1) |
| 79 .RetiresOnSaturation(); | 80 .RetiresOnSaturation(); |
| 80 EXPECT_TRUE(manager_->BeginQuery(query)); | 81 EXPECT_TRUE(manager_->BeginQuery(query)); |
| 81 EXPECT_TRUE(manager_->EndQuery(query, submit_count)); | 82 EXPECT_TRUE(manager_->EndQuery(query, submit_count)); |
| 82 } | 83 } |
| 83 | 84 |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 EXPECT_FALSE(query->pending()); | 208 EXPECT_FALSE(query->pending()); |
| 208 EXPECT_EQ(kTarget, query->target()); | 209 EXPECT_EQ(kTarget, query->target()); |
| 209 EXPECT_EQ(kSharedMemoryId, query->shm_id()); | 210 EXPECT_EQ(kSharedMemoryId, query->shm_id()); |
| 210 EXPECT_EQ(kSharedMemoryOffset, query->shm_offset()); | 211 EXPECT_EQ(kSharedMemoryOffset, query->shm_offset()); |
| 211 } | 212 } |
| 212 | 213 |
| 213 TEST_F(QueryManagerTest, ProcessPendingQuery) { | 214 TEST_F(QueryManagerTest, ProcessPendingQuery) { |
| 214 const GLuint kClient1Id = 1; | 215 const GLuint kClient1Id = 1; |
| 215 const GLuint kService1Id = 11; | 216 const GLuint kService1Id = 11; |
| 216 const GLenum kTarget = GL_ANY_SAMPLES_PASSED_EXT; | 217 const GLenum kTarget = GL_ANY_SAMPLES_PASSED_EXT; |
| 217 const uint32 kSubmitCount = 123; | 218 const base::subtle::Atomic32 kSubmitCount = 123; |
| 218 const GLuint kResult = 1; | 219 const GLuint kResult = 1; |
| 219 | 220 |
| 220 // Check nothing happens if there are no pending queries. | 221 // Check nothing happens if there are no pending queries. |
| 221 EXPECT_TRUE(manager_->ProcessPendingQueries()); | 222 EXPECT_TRUE(manager_->ProcessPendingQueries()); |
| 222 | 223 |
| 223 // Create Query. | 224 // Create Query. |
| 224 scoped_refptr<QueryManager::Query> query( | 225 scoped_refptr<QueryManager::Query> query( |
| 225 CreateQuery(kTarget, kClient1Id, | 226 CreateQuery(kTarget, kClient1Id, |
| 226 kSharedMemoryId, kSharedMemoryOffset, kService1Id)); | 227 kSharedMemoryId, kSharedMemoryOffset, kService1Id)); |
| 227 ASSERT_TRUE(query.get() != NULL); | 228 ASSERT_TRUE(query.get() != NULL); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 238 EXPECT_TRUE(manager_->HavePendingQueries()); | 239 EXPECT_TRUE(manager_->HavePendingQueries()); |
| 239 | 240 |
| 240 // Process with return not available. | 241 // Process with return not available. |
| 241 // Expect 1 GL command. | 242 // Expect 1 GL command. |
| 242 EXPECT_CALL(*gl_, | 243 EXPECT_CALL(*gl_, |
| 243 GetQueryObjectuivARB(kService1Id, GL_QUERY_RESULT_AVAILABLE_EXT, _)) | 244 GetQueryObjectuivARB(kService1Id, GL_QUERY_RESULT_AVAILABLE_EXT, _)) |
| 244 .WillOnce(SetArgumentPointee<2>(0)) | 245 .WillOnce(SetArgumentPointee<2>(0)) |
| 245 .RetiresOnSaturation(); | 246 .RetiresOnSaturation(); |
| 246 EXPECT_TRUE(manager_->ProcessPendingQueries()); | 247 EXPECT_TRUE(manager_->ProcessPendingQueries()); |
| 247 EXPECT_TRUE(query->pending()); | 248 EXPECT_TRUE(query->pending()); |
| 248 EXPECT_EQ(0u, sync->process_count); | 249 EXPECT_EQ(0, sync->process_count); |
| 249 EXPECT_EQ(0u, sync->result); | 250 EXPECT_EQ(0u, sync->result); |
| 250 | 251 |
| 251 // Process with return available. | 252 // Process with return available. |
| 252 // Expect 2 GL commands. | 253 // Expect 2 GL commands. |
| 253 EXPECT_CALL(*gl_, | 254 EXPECT_CALL(*gl_, |
| 254 GetQueryObjectuivARB(kService1Id, GL_QUERY_RESULT_AVAILABLE_EXT, _)) | 255 GetQueryObjectuivARB(kService1Id, GL_QUERY_RESULT_AVAILABLE_EXT, _)) |
| 255 .WillOnce(SetArgumentPointee<2>(1)) | 256 .WillOnce(SetArgumentPointee<2>(1)) |
| 256 .RetiresOnSaturation(); | 257 .RetiresOnSaturation(); |
| 257 EXPECT_CALL(*gl_, | 258 EXPECT_CALL(*gl_, |
| 258 GetQueryObjectuivARB(kService1Id, GL_QUERY_RESULT_EXT, _)) | 259 GetQueryObjectuivARB(kService1Id, GL_QUERY_RESULT_EXT, _)) |
| (...skipping 11 matching lines...) Expand all Loading... |
| 270 } | 271 } |
| 271 | 272 |
| 272 TEST_F(QueryManagerTest, ProcessPendingQueries) { | 273 TEST_F(QueryManagerTest, ProcessPendingQueries) { |
| 273 const GLuint kClient1Id = 1; | 274 const GLuint kClient1Id = 1; |
| 274 const GLuint kService1Id = 11; | 275 const GLuint kService1Id = 11; |
| 275 const GLuint kClient2Id = 2; | 276 const GLuint kClient2Id = 2; |
| 276 const GLuint kService2Id = 12; | 277 const GLuint kService2Id = 12; |
| 277 const GLuint kClient3Id = 3; | 278 const GLuint kClient3Id = 3; |
| 278 const GLuint kService3Id = 13; | 279 const GLuint kService3Id = 13; |
| 279 const GLenum kTarget = GL_ANY_SAMPLES_PASSED_EXT; | 280 const GLenum kTarget = GL_ANY_SAMPLES_PASSED_EXT; |
| 280 const uint32 kSubmitCount1 = 123; | 281 const base::subtle::Atomic32 kSubmitCount1 = 123; |
| 281 const uint32 kSubmitCount2 = 123; | 282 const base::subtle::Atomic32 kSubmitCount2 = 123; |
| 282 const uint32 kSubmitCount3 = 123; | 283 const base::subtle::Atomic32 kSubmitCount3 = 123; |
| 283 const GLuint kResult1 = 1; | 284 const GLuint kResult1 = 1; |
| 284 const GLuint kResult2 = 1; | 285 const GLuint kResult2 = 1; |
| 285 const GLuint kResult3 = 1; | 286 const GLuint kResult3 = 1; |
| 286 | 287 |
| 287 // Setup shared memory like client would. | 288 // Setup shared memory like client would. |
| 288 QuerySync* sync1 = decoder_->GetSharedMemoryAs<QuerySync*>( | 289 QuerySync* sync1 = decoder_->GetSharedMemoryAs<QuerySync*>( |
| 289 kSharedMemoryId, kSharedMemoryOffset, sizeof(*sync1) * 3); | 290 kSharedMemoryId, kSharedMemoryOffset, sizeof(*sync1) * 3); |
| 290 ASSERT_TRUE(sync1 != NULL); | 291 ASSERT_TRUE(sync1 != NULL); |
| 291 QuerySync* sync2 = sync1 + 1; | 292 QuerySync* sync2 = sync1 + 1; |
| 292 QuerySync* sync3 = sync2 + 1; | 293 QuerySync* sync3 = sync2 + 1; |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 348 .RetiresOnSaturation(); | 349 .RetiresOnSaturation(); |
| 349 EXPECT_TRUE(manager_->ProcessPendingQueries()); | 350 EXPECT_TRUE(manager_->ProcessPendingQueries()); |
| 350 } | 351 } |
| 351 EXPECT_FALSE(query1->pending()); | 352 EXPECT_FALSE(query1->pending()); |
| 352 EXPECT_FALSE(query2->pending()); | 353 EXPECT_FALSE(query2->pending()); |
| 353 EXPECT_TRUE(query3->pending()); | 354 EXPECT_TRUE(query3->pending()); |
| 354 EXPECT_EQ(kSubmitCount1, sync1->process_count); | 355 EXPECT_EQ(kSubmitCount1, sync1->process_count); |
| 355 EXPECT_EQ(kSubmitCount2, sync2->process_count); | 356 EXPECT_EQ(kSubmitCount2, sync2->process_count); |
| 356 EXPECT_EQ(kResult1, sync1->result); | 357 EXPECT_EQ(kResult1, sync1->result); |
| 357 EXPECT_EQ(kResult2, sync2->result); | 358 EXPECT_EQ(kResult2, sync2->result); |
| 358 EXPECT_EQ(0u, sync3->process_count); | 359 EXPECT_EQ(0, sync3->process_count); |
| 359 EXPECT_EQ(0u, sync3->result); | 360 EXPECT_EQ(0u, sync3->result); |
| 360 EXPECT_TRUE(manager_->HavePendingQueries()); | 361 EXPECT_TRUE(manager_->HavePendingQueries()); |
| 361 | 362 |
| 362 // Process with renaming query. No result. | 363 // Process with renaming query. No result. |
| 363 // Expect 1 GL commands. | 364 // Expect 1 GL commands. |
| 364 EXPECT_CALL(*gl_, | 365 EXPECT_CALL(*gl_, |
| 365 GetQueryObjectuivARB(kService3Id, GL_QUERY_RESULT_AVAILABLE_EXT, _)) | 366 GetQueryObjectuivARB(kService3Id, GL_QUERY_RESULT_AVAILABLE_EXT, _)) |
| 366 .WillOnce(SetArgumentPointee<2>(0)) | 367 .WillOnce(SetArgumentPointee<2>(0)) |
| 367 .RetiresOnSaturation(); | 368 .RetiresOnSaturation(); |
| 368 EXPECT_TRUE(manager_->ProcessPendingQueries()); | 369 EXPECT_TRUE(manager_->ProcessPendingQueries()); |
| 369 EXPECT_TRUE(query3->pending()); | 370 EXPECT_TRUE(query3->pending()); |
| 370 EXPECT_EQ(0u, sync3->process_count); | 371 EXPECT_EQ(0, sync3->process_count); |
| 371 EXPECT_EQ(0u, sync3->result); | 372 EXPECT_EQ(0u, sync3->result); |
| 372 EXPECT_TRUE(manager_->HavePendingQueries()); | 373 EXPECT_TRUE(manager_->HavePendingQueries()); |
| 373 | 374 |
| 374 // Process with renaming query. With result. | 375 // Process with renaming query. With result. |
| 375 // Expect 2 GL commands. | 376 // Expect 2 GL commands. |
| 376 EXPECT_CALL(*gl_, | 377 EXPECT_CALL(*gl_, |
| 377 GetQueryObjectuivARB(kService3Id, GL_QUERY_RESULT_AVAILABLE_EXT, _)) | 378 GetQueryObjectuivARB(kService3Id, GL_QUERY_RESULT_AVAILABLE_EXT, _)) |
| 378 .WillOnce(SetArgumentPointee<2>(1)) | 379 .WillOnce(SetArgumentPointee<2>(1)) |
| 379 .RetiresOnSaturation(); | 380 .RetiresOnSaturation(); |
| 380 EXPECT_CALL(*gl_, | 381 EXPECT_CALL(*gl_, |
| 381 GetQueryObjectuivARB(kService3Id, GL_QUERY_RESULT_EXT, _)) | 382 GetQueryObjectuivARB(kService3Id, GL_QUERY_RESULT_EXT, _)) |
| 382 .WillOnce(SetArgumentPointee<2>(kResult3)) | 383 .WillOnce(SetArgumentPointee<2>(kResult3)) |
| 383 .RetiresOnSaturation(); | 384 .RetiresOnSaturation(); |
| 384 EXPECT_TRUE(manager_->ProcessPendingQueries()); | 385 EXPECT_TRUE(manager_->ProcessPendingQueries()); |
| 385 EXPECT_FALSE(query3->pending()); | 386 EXPECT_FALSE(query3->pending()); |
| 386 EXPECT_EQ(kSubmitCount3, sync3->process_count); | 387 EXPECT_EQ(kSubmitCount3, sync3->process_count); |
| 387 EXPECT_EQ(kResult3, sync3->result); | 388 EXPECT_EQ(kResult3, sync3->result); |
| 388 EXPECT_FALSE(manager_->HavePendingQueries()); | 389 EXPECT_FALSE(manager_->HavePendingQueries()); |
| 389 } | 390 } |
| 390 | 391 |
| 391 TEST_F(QueryManagerTest, ProcessPendingBadSharedMemoryId) { | 392 TEST_F(QueryManagerTest, ProcessPendingBadSharedMemoryId) { |
| 392 const GLuint kClient1Id = 1; | 393 const GLuint kClient1Id = 1; |
| 393 const GLuint kService1Id = 11; | 394 const GLuint kService1Id = 11; |
| 394 const GLenum kTarget = GL_ANY_SAMPLES_PASSED_EXT; | 395 const GLenum kTarget = GL_ANY_SAMPLES_PASSED_EXT; |
| 395 const uint32 kSubmitCount = 123; | 396 const base::subtle::Atomic32 kSubmitCount = 123; |
| 396 const GLuint kResult = 1; | 397 const GLuint kResult = 1; |
| 397 | 398 |
| 398 // Create Query. | 399 // Create Query. |
| 399 scoped_refptr<QueryManager::Query> query( | 400 scoped_refptr<QueryManager::Query> query( |
| 400 CreateQuery(kTarget, kClient1Id, | 401 CreateQuery(kTarget, kClient1Id, |
| 401 kInvalidSharedMemoryId, kSharedMemoryOffset, kService1Id)); | 402 kInvalidSharedMemoryId, kSharedMemoryOffset, kService1Id)); |
| 402 ASSERT_TRUE(query.get() != NULL); | 403 ASSERT_TRUE(query.get() != NULL); |
| 403 | 404 |
| 404 // Queue it | 405 // Queue it |
| 405 QueueQuery(query.get(), kService1Id, kSubmitCount); | 406 QueueQuery(query.get(), kService1Id, kSubmitCount); |
| 406 | 407 |
| 407 // Process with return available. | 408 // Process with return available. |
| 408 // Expect 2 GL commands. | 409 // Expect 2 GL commands. |
| 409 EXPECT_CALL(*gl_, | 410 EXPECT_CALL(*gl_, |
| 410 GetQueryObjectuivARB(kService1Id, GL_QUERY_RESULT_AVAILABLE_EXT, _)) | 411 GetQueryObjectuivARB(kService1Id, GL_QUERY_RESULT_AVAILABLE_EXT, _)) |
| 411 .WillOnce(SetArgumentPointee<2>(1)) | 412 .WillOnce(SetArgumentPointee<2>(1)) |
| 412 .RetiresOnSaturation(); | 413 .RetiresOnSaturation(); |
| 413 EXPECT_CALL(*gl_, | 414 EXPECT_CALL(*gl_, |
| 414 GetQueryObjectuivARB(kService1Id, GL_QUERY_RESULT_EXT, _)) | 415 GetQueryObjectuivARB(kService1Id, GL_QUERY_RESULT_EXT, _)) |
| 415 .WillOnce(SetArgumentPointee<2>(kResult)) | 416 .WillOnce(SetArgumentPointee<2>(kResult)) |
| 416 .RetiresOnSaturation(); | 417 .RetiresOnSaturation(); |
| 417 EXPECT_FALSE(manager_->ProcessPendingQueries()); | 418 EXPECT_FALSE(manager_->ProcessPendingQueries()); |
| 418 } | 419 } |
| 419 | 420 |
| 420 TEST_F(QueryManagerTest, ProcessPendingBadSharedMemoryOffset) { | 421 TEST_F(QueryManagerTest, ProcessPendingBadSharedMemoryOffset) { |
| 421 const GLuint kClient1Id = 1; | 422 const GLuint kClient1Id = 1; |
| 422 const GLuint kService1Id = 11; | 423 const GLuint kService1Id = 11; |
| 423 const GLenum kTarget = GL_ANY_SAMPLES_PASSED_EXT; | 424 const GLenum kTarget = GL_ANY_SAMPLES_PASSED_EXT; |
| 424 const uint32 kSubmitCount = 123; | 425 const base::subtle::Atomic32 kSubmitCount = 123; |
| 425 const GLuint kResult = 1; | 426 const GLuint kResult = 1; |
| 426 | 427 |
| 427 // Create Query. | 428 // Create Query. |
| 428 scoped_refptr<QueryManager::Query> query( | 429 scoped_refptr<QueryManager::Query> query( |
| 429 CreateQuery(kTarget, kClient1Id, | 430 CreateQuery(kTarget, kClient1Id, |
| 430 kSharedMemoryId, kInvalidSharedMemoryOffset, kService1Id)); | 431 kSharedMemoryId, kInvalidSharedMemoryOffset, kService1Id)); |
| 431 ASSERT_TRUE(query.get() != NULL); | 432 ASSERT_TRUE(query.get() != NULL); |
| 432 | 433 |
| 433 // Queue it | 434 // Queue it |
| 434 QueueQuery(query.get(), kService1Id, kSubmitCount); | 435 QueueQuery(query.get(), kService1Id, kSubmitCount); |
| 435 | 436 |
| 436 // Process with return available. | 437 // Process with return available. |
| 437 // Expect 2 GL commands. | 438 // Expect 2 GL commands. |
| 438 EXPECT_CALL(*gl_, | 439 EXPECT_CALL(*gl_, |
| 439 GetQueryObjectuivARB(kService1Id, GL_QUERY_RESULT_AVAILABLE_EXT, _)) | 440 GetQueryObjectuivARB(kService1Id, GL_QUERY_RESULT_AVAILABLE_EXT, _)) |
| 440 .WillOnce(SetArgumentPointee<2>(1)) | 441 .WillOnce(SetArgumentPointee<2>(1)) |
| 441 .RetiresOnSaturation(); | 442 .RetiresOnSaturation(); |
| 442 EXPECT_CALL(*gl_, | 443 EXPECT_CALL(*gl_, |
| 443 GetQueryObjectuivARB(kService1Id, GL_QUERY_RESULT_EXT, _)) | 444 GetQueryObjectuivARB(kService1Id, GL_QUERY_RESULT_EXT, _)) |
| 444 .WillOnce(SetArgumentPointee<2>(kResult)) | 445 .WillOnce(SetArgumentPointee<2>(kResult)) |
| 445 .RetiresOnSaturation(); | 446 .RetiresOnSaturation(); |
| 446 EXPECT_FALSE(manager_->ProcessPendingQueries()); | 447 EXPECT_FALSE(manager_->ProcessPendingQueries()); |
| 447 } | 448 } |
| 448 | 449 |
| 449 TEST_F(QueryManagerTest, ExitWithPendingQuery) { | 450 TEST_F(QueryManagerTest, ExitWithPendingQuery) { |
| 450 const GLuint kClient1Id = 1; | 451 const GLuint kClient1Id = 1; |
| 451 const GLuint kService1Id = 11; | 452 const GLuint kService1Id = 11; |
| 452 const GLenum kTarget = GL_ANY_SAMPLES_PASSED_EXT; | 453 const GLenum kTarget = GL_ANY_SAMPLES_PASSED_EXT; |
| 453 const uint32 kSubmitCount = 123; | 454 const base::subtle::Atomic32 kSubmitCount = 123; |
| 454 | 455 |
| 455 // Create Query. | 456 // Create Query. |
| 456 scoped_refptr<QueryManager::Query> query( | 457 scoped_refptr<QueryManager::Query> query( |
| 457 CreateQuery(kTarget, kClient1Id, | 458 CreateQuery(kTarget, kClient1Id, |
| 458 kSharedMemoryId, kSharedMemoryOffset, kService1Id)); | 459 kSharedMemoryId, kSharedMemoryOffset, kService1Id)); |
| 459 ASSERT_TRUE(query.get() != NULL); | 460 ASSERT_TRUE(query.get() != NULL); |
| 460 | 461 |
| 461 // Queue it | 462 // Queue it |
| 462 QueueQuery(query.get(), kService1Id, kSubmitCount); | 463 QueueQuery(query.get(), kService1Id, kSubmitCount); |
| 463 } | 464 } |
| 464 | 465 |
| 465 // Test that when based on ARB_occlusion_query2 we use GL_ANY_SAMPLES_PASSED_ARB | 466 // Test that when based on ARB_occlusion_query2 we use GL_ANY_SAMPLES_PASSED_ARB |
| 466 // for GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT | 467 // for GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT |
| 467 TEST_F(QueryManagerTest, ARBOcclusionQuery2) { | 468 TEST_F(QueryManagerTest, ARBOcclusionQuery2) { |
| 468 const GLuint kClient1Id = 1; | 469 const GLuint kClient1Id = 1; |
| 469 const GLuint kService1Id = 11; | 470 const GLuint kService1Id = 11; |
| 470 const GLenum kTarget = GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT; | 471 const GLenum kTarget = GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT; |
| 471 const uint32 kSubmitCount = 123; | 472 const base::subtle::Atomic32 kSubmitCount = 123; |
| 472 | 473 |
| 473 TestHelper::SetupFeatureInfoInitExpectations( | 474 TestHelper::SetupFeatureInfoInitExpectations( |
| 474 gl_.get(), | 475 gl_.get(), |
| 475 "GL_ARB_occlusion_query2"); | 476 "GL_ARB_occlusion_query2"); |
| 476 scoped_refptr<FeatureInfo> feature_info(new FeatureInfo()); | 477 scoped_refptr<FeatureInfo> feature_info(new FeatureInfo()); |
| 477 feature_info->Initialize(); | 478 feature_info->Initialize(); |
| 478 scoped_ptr<QueryManager> manager( | 479 scoped_ptr<QueryManager> manager( |
| 479 new QueryManager(decoder_.get(), feature_info.get())); | 480 new QueryManager(decoder_.get(), feature_info.get())); |
| 480 | 481 |
| 481 EXPECT_CALL(*gl_, GenQueriesARB(1, _)) | 482 EXPECT_CALL(*gl_, GenQueriesARB(1, _)) |
| (...skipping 13 matching lines...) Expand all Loading... |
| 495 EXPECT_TRUE(manager->EndQuery(query, kSubmitCount)); | 496 EXPECT_TRUE(manager->EndQuery(query, kSubmitCount)); |
| 496 manager->Destroy(false); | 497 manager->Destroy(false); |
| 497 } | 498 } |
| 498 | 499 |
| 499 // Test that when based on ARB_occlusion_query we use GL_SAMPLES_PASSED_ARB | 500 // Test that when based on ARB_occlusion_query we use GL_SAMPLES_PASSED_ARB |
| 500 // for GL_ANY_SAMPLES_PASSED_EXT | 501 // for GL_ANY_SAMPLES_PASSED_EXT |
| 501 TEST_F(QueryManagerTest, ARBOcclusionQuery) { | 502 TEST_F(QueryManagerTest, ARBOcclusionQuery) { |
| 502 const GLuint kClient1Id = 1; | 503 const GLuint kClient1Id = 1; |
| 503 const GLuint kService1Id = 11; | 504 const GLuint kService1Id = 11; |
| 504 const GLenum kTarget = GL_ANY_SAMPLES_PASSED_EXT; | 505 const GLenum kTarget = GL_ANY_SAMPLES_PASSED_EXT; |
| 505 const uint32 kSubmitCount = 123; | 506 const base::subtle::Atomic32 kSubmitCount = 123; |
| 506 | 507 |
| 507 TestHelper::SetupFeatureInfoInitExpectations( | 508 TestHelper::SetupFeatureInfoInitExpectations( |
| 508 gl_.get(), | 509 gl_.get(), |
| 509 "GL_ARB_occlusion_query"); | 510 "GL_ARB_occlusion_query"); |
| 510 scoped_refptr<FeatureInfo> feature_info(new FeatureInfo()); | 511 scoped_refptr<FeatureInfo> feature_info(new FeatureInfo()); |
| 511 feature_info->Initialize(); | 512 feature_info->Initialize(); |
| 512 scoped_ptr<QueryManager> manager( | 513 scoped_ptr<QueryManager> manager( |
| 513 new QueryManager(decoder_.get(), feature_info.get())); | 514 new QueryManager(decoder_.get(), feature_info.get())); |
| 514 | 515 |
| 515 EXPECT_CALL(*gl_, GenQueriesARB(1, _)) | 516 EXPECT_CALL(*gl_, GenQueriesARB(1, _)) |
| (...skipping 10 matching lines...) Expand all Loading... |
| 526 .Times(1) | 527 .Times(1) |
| 527 .RetiresOnSaturation(); | 528 .RetiresOnSaturation(); |
| 528 EXPECT_TRUE(manager->BeginQuery(query)); | 529 EXPECT_TRUE(manager->BeginQuery(query)); |
| 529 EXPECT_TRUE(manager->EndQuery(query, kSubmitCount)); | 530 EXPECT_TRUE(manager->EndQuery(query, kSubmitCount)); |
| 530 manager->Destroy(false); | 531 manager->Destroy(false); |
| 531 } | 532 } |
| 532 | 533 |
| 533 TEST_F(QueryManagerTest, GetErrorQuery) { | 534 TEST_F(QueryManagerTest, GetErrorQuery) { |
| 534 const GLuint kClient1Id = 1; | 535 const GLuint kClient1Id = 1; |
| 535 const GLenum kTarget = GL_GET_ERROR_QUERY_CHROMIUM; | 536 const GLenum kTarget = GL_GET_ERROR_QUERY_CHROMIUM; |
| 536 const uint32 kSubmitCount = 123; | 537 const base::subtle::Atomic32 kSubmitCount = 123; |
| 537 | 538 |
| 538 TestHelper::SetupFeatureInfoInitExpectations(gl_.get(), ""); | 539 TestHelper::SetupFeatureInfoInitExpectations(gl_.get(), ""); |
| 539 scoped_refptr<FeatureInfo> feature_info(new FeatureInfo()); | 540 scoped_refptr<FeatureInfo> feature_info(new FeatureInfo()); |
| 540 feature_info->Initialize(); | 541 feature_info->Initialize(); |
| 541 scoped_ptr<QueryManager> manager( | 542 scoped_ptr<QueryManager> manager( |
| 542 new QueryManager(decoder_.get(), feature_info.get())); | 543 new QueryManager(decoder_.get(), feature_info.get())); |
| 543 | 544 |
| 544 QueryManager::Query* query = manager->CreateQuery( | 545 QueryManager::Query* query = manager->CreateQuery( |
| 545 kTarget, kClient1Id, kSharedMemoryId, kSharedMemoryOffset); | 546 kTarget, kClient1Id, kSharedMemoryId, kSharedMemoryOffset); |
| 546 ASSERT_TRUE(query != NULL); | 547 ASSERT_TRUE(query != NULL); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 565 | 566 |
| 566 EXPECT_EQ(static_cast<GLuint>(GL_INVALID_ENUM), sync->result); | 567 EXPECT_EQ(static_cast<GLuint>(GL_INVALID_ENUM), sync->result); |
| 567 | 568 |
| 568 manager->Destroy(false); | 569 manager->Destroy(false); |
| 569 } | 570 } |
| 570 | 571 |
| 571 } // namespace gles2 | 572 } // namespace gles2 |
| 572 } // namespace gpu | 573 } // namespace gpu |
| 573 | 574 |
| 574 | 575 |
| OLD | NEW |