| 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/gles2_cmd_decoder_unittest.h" | 5 #include "gpu/command_buffer/service/gles2_cmd_decoder_unittest.h" |
| 6 | 6 |
| 7 #include <stddef.h> |
| 8 #include <stdint.h> |
| 9 |
| 7 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| 8 #include "base/strings/string_number_conversions.h" | 11 #include "base/strings/string_number_conversions.h" |
| 9 #include "gpu/command_buffer/common/gles2_cmd_format.h" | 12 #include "gpu/command_buffer/common/gles2_cmd_format.h" |
| 10 #include "gpu/command_buffer/common/gles2_cmd_utils.h" | 13 #include "gpu/command_buffer/common/gles2_cmd_utils.h" |
| 11 #include "gpu/command_buffer/service/cmd_buffer_engine.h" | 14 #include "gpu/command_buffer/service/cmd_buffer_engine.h" |
| 12 #include "gpu/command_buffer/service/context_group.h" | 15 #include "gpu/command_buffer/service/context_group.h" |
| 13 #include "gpu/command_buffer/service/context_state.h" | 16 #include "gpu/command_buffer/service/context_state.h" |
| 14 #include "gpu/command_buffer/service/gl_surface_mock.h" | 17 #include "gpu/command_buffer/service/gl_surface_mock.h" |
| 15 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" | 18 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" |
| 16 #include "gpu/command_buffer/service/image_manager.h" | 19 #include "gpu/command_buffer/service/image_manager.h" |
| (...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 442 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd3)); | 445 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd3)); |
| 443 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); | 446 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
| 444 | 447 |
| 445 BindRenderbuffer cmd4; | 448 BindRenderbuffer cmd4; |
| 446 cmd4.Init(GL_RENDERBUFFER, kInvalidClientId); | 449 cmd4.Init(GL_RENDERBUFFER, kInvalidClientId); |
| 447 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd4)); | 450 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd4)); |
| 448 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); | 451 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
| 449 } | 452 } |
| 450 | 453 |
| 451 TEST_P(GLES2DecoderTest, EnableFeatureCHROMIUMBadBucket) { | 454 TEST_P(GLES2DecoderTest, EnableFeatureCHROMIUMBadBucket) { |
| 452 const uint32 kBadBucketId = 123; | 455 const uint32_t kBadBucketId = 123; |
| 453 EnableFeatureCHROMIUM cmd; | 456 EnableFeatureCHROMIUM cmd; |
| 454 cmd.Init(kBadBucketId, shared_memory_id_, shared_memory_offset_); | 457 cmd.Init(kBadBucketId, shared_memory_id_, shared_memory_offset_); |
| 455 EXPECT_NE(error::kNoError, ExecuteCmd(cmd)); | 458 EXPECT_NE(error::kNoError, ExecuteCmd(cmd)); |
| 456 } | 459 } |
| 457 | 460 |
| 458 TEST_P(GLES2DecoderTest, RequestExtensionCHROMIUMBadBucket) { | 461 TEST_P(GLES2DecoderTest, RequestExtensionCHROMIUMBadBucket) { |
| 459 const uint32 kBadBucketId = 123; | 462 const uint32_t kBadBucketId = 123; |
| 460 RequestExtensionCHROMIUM cmd; | 463 RequestExtensionCHROMIUM cmd; |
| 461 cmd.Init(kBadBucketId); | 464 cmd.Init(kBadBucketId); |
| 462 EXPECT_NE(error::kNoError, ExecuteCmd(cmd)); | 465 EXPECT_NE(error::kNoError, ExecuteCmd(cmd)); |
| 463 } | 466 } |
| 464 | 467 |
| 465 TEST_P(GLES2DecoderTest, BeginQueryEXTDisabled) { | 468 TEST_P(GLES2DecoderTest, BeginQueryEXTDisabled) { |
| 466 // Test something fails if off. | 469 // Test something fails if off. |
| 467 } | 470 } |
| 468 | 471 |
| 469 TEST_P(GLES2DecoderManualInitTest, BeginEndQueryEXT) { | 472 TEST_P(GLES2DecoderManualInitTest, BeginEndQueryEXT) { |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 575 .RetiresOnSaturation(); | 578 .RetiresOnSaturation(); |
| 576 } | 579 } |
| 577 } | 580 } |
| 578 | 581 |
| 579 static error::Error ExecuteBeginQueryCmd(GLES2DecoderTestBase* test, | 582 static error::Error ExecuteBeginQueryCmd(GLES2DecoderTestBase* test, |
| 580 ::gfx::MockGLInterface* gl, | 583 ::gfx::MockGLInterface* gl, |
| 581 ::gfx::GPUTimingFake* timing_queries, | 584 ::gfx::GPUTimingFake* timing_queries, |
| 582 GLenum target, | 585 GLenum target, |
| 583 GLuint client_id, | 586 GLuint client_id, |
| 584 GLuint service_id, | 587 GLuint service_id, |
| 585 int32 shm_id, | 588 int32_t shm_id, |
| 586 uint32 shm_offset) { | 589 uint32_t shm_offset) { |
| 587 if (GL_ANY_SAMPLES_PASSED_EXT == target) { | 590 if (GL_ANY_SAMPLES_PASSED_EXT == target) { |
| 588 EXPECT_CALL(*gl, BeginQuery(target, service_id)) | 591 EXPECT_CALL(*gl, BeginQuery(target, service_id)) |
| 589 .Times(1) | 592 .Times(1) |
| 590 .RetiresOnSaturation(); | 593 .RetiresOnSaturation(); |
| 591 } else if (GL_TIME_ELAPSED == target) { | 594 } else if (GL_TIME_ELAPSED == target) { |
| 592 timing_queries->ExpectGPUTimerQuery(*gl, true); | 595 timing_queries->ExpectGPUTimerQuery(*gl, true); |
| 593 } | 596 } |
| 594 | 597 |
| 595 BeginQueryEXT begin_cmd; | 598 BeginQueryEXT begin_cmd; |
| 596 begin_cmd.Init(target, client_id, shm_id, shm_offset); | 599 begin_cmd.Init(target, client_id, shm_id, shm_offset); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 619 .WillRepeatedly(Return(GL_TRUE)); | 622 .WillRepeatedly(Return(GL_TRUE)); |
| 620 #endif | 623 #endif |
| 621 } | 624 } |
| 622 | 625 |
| 623 EndQueryEXT end_cmd; | 626 EndQueryEXT end_cmd; |
| 624 end_cmd.Init(target, submit_count); | 627 end_cmd.Init(target, submit_count); |
| 625 return test->ExecuteCmd(end_cmd); | 628 return test->ExecuteCmd(end_cmd); |
| 626 } | 629 } |
| 627 | 630 |
| 628 static error::Error ExecuteQueryCounterCmd(GLES2DecoderTestBase* test, | 631 static error::Error ExecuteQueryCounterCmd(GLES2DecoderTestBase* test, |
| 629 ::gfx::MockGLInterface* gl, | 632 ::gfx::MockGLInterface* gl, |
| 630 ::gfx::GPUTimingFake* timing_queries, | 633 ::gfx::GPUTimingFake* timing_queries, |
| 631 GLenum target, | 634 GLenum target, |
| 632 GLuint client_id, | 635 GLuint client_id, |
| 633 GLuint service_id, | 636 GLuint service_id, |
| 634 int32 shm_id, | 637 int32_t shm_id, |
| 635 uint32 shm_offset, | 638 uint32_t shm_offset, |
| 636 uint32_t submit_count) { | 639 uint32_t submit_count) { |
| 637 if (GL_TIMESTAMP == target) { | 640 if (GL_TIMESTAMP == target) { |
| 638 timing_queries->ExpectGPUTimeStampQuery(*gl, false); | 641 timing_queries->ExpectGPUTimeStampQuery(*gl, false); |
| 639 } | 642 } |
| 640 | 643 |
| 641 QueryCounterEXT query_counter_cmd; | 644 QueryCounterEXT query_counter_cmd; |
| 642 query_counter_cmd.Init(client_id, | 645 query_counter_cmd.Init(client_id, |
| 643 target, | 646 target, |
| 644 shm_id, | 647 shm_id, |
| 645 shm_offset, | 648 shm_offset, |
| 646 submit_count); | 649 submit_count); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 671 if (!query_manager) | 674 if (!query_manager) |
| 672 return false; | 675 return false; |
| 673 | 676 |
| 674 return query_manager->ProcessPendingQueries(false); | 677 return query_manager->ProcessPendingQueries(false); |
| 675 } | 678 } |
| 676 | 679 |
| 677 static void CheckBeginEndQueryBadMemoryFails(GLES2DecoderTestBase* test, | 680 static void CheckBeginEndQueryBadMemoryFails(GLES2DecoderTestBase* test, |
| 678 GLuint client_id, | 681 GLuint client_id, |
| 679 GLuint service_id, | 682 GLuint service_id, |
| 680 const QueryType& query_type, | 683 const QueryType& query_type, |
| 681 int32 shm_id, | 684 int32_t shm_id, |
| 682 uint32 shm_offset) { | 685 uint32_t shm_offset) { |
| 683 // We need to reset the decoder on each iteration, because we lose the | 686 // We need to reset the decoder on each iteration, because we lose the |
| 684 // context every time. | 687 // context every time. |
| 685 GLES2DecoderTestBase::InitState init; | 688 GLES2DecoderTestBase::InitState init; |
| 686 init.extensions = "GL_EXT_occlusion_query_boolean" | 689 init.extensions = "GL_EXT_occlusion_query_boolean" |
| 687 " GL_ARB_sync" | 690 " GL_ARB_sync" |
| 688 " GL_ARB_timer_query"; | 691 " GL_ARB_timer_query"; |
| 689 init.gl_version = "opengl es 3.0"; | 692 init.gl_version = "opengl es 3.0"; |
| 690 init.has_alpha = true; | 693 init.has_alpha = true; |
| 691 init.request_alpha = true; | 694 init.request_alpha = true; |
| 692 init.bind_generates_resource = true; | 695 init.bind_generates_resource = true; |
| (...skipping 852 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1545 INSTANTIATE_TEST_CASE_P(Service, GLES2DecoderDoCommandsTest, ::testing::Bool()); | 1548 INSTANTIATE_TEST_CASE_P(Service, GLES2DecoderDoCommandsTest, ::testing::Bool()); |
| 1546 | 1549 |
| 1547 INSTANTIATE_TEST_CASE_P(Service, GLES3DecoderTest, ::testing::Bool()); | 1550 INSTANTIATE_TEST_CASE_P(Service, GLES3DecoderTest, ::testing::Bool()); |
| 1548 | 1551 |
| 1549 INSTANTIATE_TEST_CASE_P(Service, | 1552 INSTANTIATE_TEST_CASE_P(Service, |
| 1550 GLES3DecoderWithESSL3ShaderTest, | 1553 GLES3DecoderWithESSL3ShaderTest, |
| 1551 ::testing::Bool()); | 1554 ::testing::Bool()); |
| 1552 | 1555 |
| 1553 } // namespace gles2 | 1556 } // namespace gles2 |
| 1554 } // namespace gpu | 1557 } // namespace gpu |
| OLD | NEW |