| 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> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 686 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 697 ::testing::StrictMock< ::gfx::MockGLInterface>* gl = test->GetGLMock(); | 697 ::testing::StrictMock< ::gfx::MockGLInterface>* gl = test->GetGLMock(); |
| 698 ::gfx::GPUTimingFake gpu_timing_queries; | 698 ::gfx::GPUTimingFake gpu_timing_queries; |
| 699 | 699 |
| 700 ExecuteGenerateQueryCmd(test, gl, query_type.type, | 700 ExecuteGenerateQueryCmd(test, gl, query_type.type, |
| 701 client_id, service_id); | 701 client_id, service_id); |
| 702 | 702 |
| 703 // Test bad shared memory fails | 703 // Test bad shared memory fails |
| 704 error::Error error1 = error::kNoError; | 704 error::Error error1 = error::kNoError; |
| 705 error::Error error2 = error::kNoError; | 705 error::Error error2 = error::kNoError; |
| 706 if (query_type.is_counter) { | 706 if (query_type.is_counter) { |
| 707 error1 = ExecuteQueryCounterCmd(test, gl, &gpu_timing_queries, | 707 error1 = |
| 708 query_type.type, | 708 ExecuteQueryCounterCmd(test, gl, &gpu_timing_queries, query_type.type, |
| 709 client_id, service_id, | 709 client_id, service_id, shm_id, shm_offset, 1); |
| 710 shm_id, shm_offset, 1); | |
| 711 } else { | 710 } else { |
| 712 error1 = ExecuteBeginQueryCmd(test, gl, &gpu_timing_queries, | 711 error1 = ExecuteBeginQueryCmd(test, gl, &gpu_timing_queries, |
| 713 query_type.type, | 712 query_type.type, |
| 714 client_id, service_id, | 713 client_id, service_id, |
| 715 shm_id, shm_offset); | 714 shm_id, shm_offset); |
| 716 error2 = ExecuteEndQueryCmd(test, gl, query_type.type, 1); | 715 error2 = ExecuteEndQueryCmd(test, gl, query_type.type, 1); |
| 717 } | 716 } |
| 718 | 717 |
| 719 bool process_success = ProcessQuery(test, gl, query_type.type, service_id); | 718 bool process_success = ProcessQuery(test, gl, query_type.type, service_id); |
| 720 | 719 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 770 init.bind_generates_resource = true; | 769 init.bind_generates_resource = true; |
| 771 InitDecoder(init); | 770 InitDecoder(init); |
| 772 ::testing::StrictMock< ::gfx::MockGLInterface>* gl = GetGLMock(); | 771 ::testing::StrictMock< ::gfx::MockGLInterface>* gl = GetGLMock(); |
| 773 ::gfx::GPUTimingFake gpu_timing_queries; | 772 ::gfx::GPUTimingFake gpu_timing_queries; |
| 774 | 773 |
| 775 ExecuteGenerateQueryCmd(this, gl, query_type.type, | 774 ExecuteGenerateQueryCmd(this, gl, query_type.type, |
| 776 kNewClientId, kNewServiceId); | 775 kNewClientId, kNewServiceId); |
| 777 | 776 |
| 778 // Query once. | 777 // Query once. |
| 779 if (query_type.is_counter) { | 778 if (query_type.is_counter) { |
| 780 EXPECT_EQ(error::kNoError, ExecuteQueryCounterCmd(this, gl, | 779 EXPECT_EQ( |
| 781 &gpu_timing_queries, | 780 error::kNoError, |
| 782 query_type.type, | 781 ExecuteQueryCounterCmd(this, gl, &gpu_timing_queries, query_type.type, |
| 783 kNewClientId, | 782 kNewClientId, kNewServiceId, kSharedMemoryId, |
| 784 kNewServiceId, | 783 kSharedMemoryOffset, 1)); |
| 785 kSharedMemoryId, | |
| 786 kSharedMemoryOffset, | |
| 787 1)); | |
| 788 } else { | 784 } else { |
| 789 EXPECT_EQ(error::kNoError, ExecuteBeginQueryCmd(this, gl, | 785 EXPECT_EQ(error::kNoError, ExecuteBeginQueryCmd(this, gl, |
| 790 &gpu_timing_queries, | 786 &gpu_timing_queries, |
| 791 query_type.type, | 787 query_type.type, |
| 792 kNewClientId, | 788 kNewClientId, |
| 793 kNewServiceId, | 789 kNewServiceId, |
| 794 kSharedMemoryId, | 790 kSharedMemoryId, |
| 795 kSharedMemoryOffset)); | 791 kSharedMemoryOffset)); |
| 796 EXPECT_EQ(error::kNoError, ExecuteEndQueryCmd(this, gl, | 792 EXPECT_EQ(error::kNoError, ExecuteEndQueryCmd(this, gl, |
| 797 query_type.type, 1)); | 793 query_type.type, 1)); |
| 798 } | 794 } |
| 799 | 795 |
| 800 EXPECT_TRUE(ProcessQuery(this, gl, query_type.type, kNewServiceId)); | 796 EXPECT_TRUE(ProcessQuery(this, gl, query_type.type, kNewServiceId)); |
| 801 | 797 |
| 802 // Reuse query. | 798 // Reuse query. |
| 803 if (query_type.is_counter) { | 799 if (query_type.is_counter) { |
| 804 EXPECT_EQ(error::kNoError, ExecuteQueryCounterCmd(this, gl, | 800 EXPECT_EQ( |
| 805 &gpu_timing_queries, | 801 error::kNoError, |
| 806 query_type.type, | 802 ExecuteQueryCounterCmd(this, gl, &gpu_timing_queries, query_type.type, |
| 807 kNewClientId, | 803 kNewClientId, kNewServiceId, kSharedMemoryId, |
| 808 kNewServiceId, | 804 kSharedMemoryOffset, 2)); |
| 809 kSharedMemoryId, | |
| 810 kSharedMemoryOffset, | |
| 811 2)); | |
| 812 } else { | 805 } else { |
| 813 EXPECT_EQ(error::kNoError, ExecuteBeginQueryCmd(this, gl, | 806 EXPECT_EQ(error::kNoError, ExecuteBeginQueryCmd(this, gl, |
| 814 &gpu_timing_queries, | 807 &gpu_timing_queries, |
| 815 query_type.type, | 808 query_type.type, |
| 816 kNewClientId, | 809 kNewClientId, |
| 817 kNewServiceId, | 810 kNewServiceId, |
| 818 kSharedMemoryId, | 811 kSharedMemoryId, |
| 819 kSharedMemoryOffset)); | 812 kSharedMemoryOffset)); |
| 820 EXPECT_EQ(error::kNoError, ExecuteEndQueryCmd(this, gl, | 813 EXPECT_EQ(error::kNoError, ExecuteEndQueryCmd(this, gl, |
| 821 query_type.type, 2)); | 814 query_type.type, 2)); |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1022 init.has_alpha = true; | 1015 init.has_alpha = true; |
| 1023 init.request_alpha = true; | 1016 init.request_alpha = true; |
| 1024 init.bind_generates_resource = true; | 1017 init.bind_generates_resource = true; |
| 1025 InitDecoder(init); | 1018 InitDecoder(init); |
| 1026 | 1019 |
| 1027 GenHelper<GenQueriesEXTImmediate>(kNewClientId); | 1020 GenHelper<GenQueriesEXTImmediate>(kNewClientId); |
| 1028 | 1021 |
| 1029 EXPECT_CALL(*gl_, GenQueries(1, _)) | 1022 EXPECT_CALL(*gl_, GenQueries(1, _)) |
| 1030 .WillOnce(SetArgPointee<1>(kNewServiceId)) | 1023 .WillOnce(SetArgPointee<1>(kNewServiceId)) |
| 1031 .RetiresOnSaturation(); | 1024 .RetiresOnSaturation(); |
| 1025 EXPECT_CALL(*gl_, GetQueryiv(GL_TIMESTAMP, GL_QUERY_COUNTER_BITS, _)) |
| 1026 .WillOnce(SetArgPointee<2>(64)) |
| 1027 .RetiresOnSaturation(); |
| 1032 EXPECT_CALL(*gl_, QueryCounter(kNewServiceId, GL_TIMESTAMP)) | 1028 EXPECT_CALL(*gl_, QueryCounter(kNewServiceId, GL_TIMESTAMP)) |
| 1033 .Times(1) | 1029 .Times(1) |
| 1034 .RetiresOnSaturation(); | 1030 .RetiresOnSaturation(); |
| 1035 QueryCounterEXT query_counter_cmd; | 1031 QueryCounterEXT query_counter_cmd; |
| 1036 query_counter_cmd.Init(kNewClientId, | 1032 query_counter_cmd.Init(kNewClientId, |
| 1037 GL_TIMESTAMP, | 1033 GL_TIMESTAMP, |
| 1038 kSharedMemoryId, | 1034 kSharedMemoryId, |
| 1039 kSharedMemoryOffset, | 1035 kSharedMemoryOffset, |
| 1040 1); | 1036 1); |
| 1041 EXPECT_EQ(error::kNoError, ExecuteCmd(query_counter_cmd)); | 1037 EXPECT_EQ(error::kNoError, ExecuteCmd(query_counter_cmd)); |
| (...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1548 INSTANTIATE_TEST_CASE_P(Service, GLES2DecoderDoCommandsTest, ::testing::Bool()); | 1544 INSTANTIATE_TEST_CASE_P(Service, GLES2DecoderDoCommandsTest, ::testing::Bool()); |
| 1549 | 1545 |
| 1550 INSTANTIATE_TEST_CASE_P(Service, GLES3DecoderTest, ::testing::Bool()); | 1546 INSTANTIATE_TEST_CASE_P(Service, GLES3DecoderTest, ::testing::Bool()); |
| 1551 | 1547 |
| 1552 INSTANTIATE_TEST_CASE_P(Service, | 1548 INSTANTIATE_TEST_CASE_P(Service, |
| 1553 GLES3DecoderWithESSL3ShaderTest, | 1549 GLES3DecoderWithESSL3ShaderTest, |
| 1554 ::testing::Bool()); | 1550 ::testing::Bool()); |
| 1555 | 1551 |
| 1556 } // namespace gles2 | 1552 } // namespace gles2 |
| 1557 } // namespace gpu | 1553 } // namespace gpu |
| OLD | NEW |