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_base.h" | 5 #include "gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
| 11 #include <memory> |
11 #include <string> | 12 #include <string> |
12 #include <vector> | 13 #include <vector> |
13 | 14 |
14 #include "base/strings/string_number_conversions.h" | 15 #include "base/strings/string_number_conversions.h" |
15 #include "base/strings/string_split.h" | 16 #include "base/strings/string_split.h" |
16 #include "gpu/command_buffer/common/gles2_cmd_format.h" | 17 #include "gpu/command_buffer/common/gles2_cmd_format.h" |
17 #include "gpu/command_buffer/common/gles2_cmd_utils.h" | 18 #include "gpu/command_buffer/common/gles2_cmd_utils.h" |
18 #include "gpu/command_buffer/common/value_state.h" | 19 #include "gpu/command_buffer/common/value_state.h" |
19 #include "gpu/command_buffer/service/cmd_buffer_engine.h" | 20 #include "gpu/command_buffer/service/cmd_buffer_engine.h" |
20 #include "gpu/command_buffer/service/context_group.h" | 21 #include "gpu/command_buffer/service/context_group.h" |
(...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
638 SetBucketData(bucket_id, str, str ? (strlen(str) + 1) : 0); | 639 SetBucketData(bucket_id, str, str ? (strlen(str) + 1) : 0); |
639 } | 640 } |
640 | 641 |
641 void GLES2DecoderTestBase::SetBucketAsCStrings(uint32_t bucket_id, | 642 void GLES2DecoderTestBase::SetBucketAsCStrings(uint32_t bucket_id, |
642 GLsizei count, | 643 GLsizei count, |
643 const char** str, | 644 const char** str, |
644 GLsizei count_in_header, | 645 GLsizei count_in_header, |
645 char str_end) { | 646 char str_end) { |
646 uint32_t header_size = sizeof(GLint) * (count + 1); | 647 uint32_t header_size = sizeof(GLint) * (count + 1); |
647 uint32_t total_size = header_size; | 648 uint32_t total_size = header_size; |
648 scoped_ptr<GLint[]> header(new GLint[count + 1]); | 649 std::unique_ptr<GLint[]> header(new GLint[count + 1]); |
649 header[0] = static_cast<GLint>(count_in_header); | 650 header[0] = static_cast<GLint>(count_in_header); |
650 for (GLsizei ii = 0; ii < count; ++ii) { | 651 for (GLsizei ii = 0; ii < count; ++ii) { |
651 header[ii + 1] = str && str[ii] ? strlen(str[ii]) : 0; | 652 header[ii + 1] = str && str[ii] ? strlen(str[ii]) : 0; |
652 total_size += header[ii + 1] + 1; | 653 total_size += header[ii + 1] + 1; |
653 } | 654 } |
654 cmd::SetBucketSize cmd1; | 655 cmd::SetBucketSize cmd1; |
655 cmd1.Init(bucket_id, total_size); | 656 cmd1.Init(bucket_id, total_size); |
656 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd1)); | 657 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd1)); |
657 memcpy(shared_memory_address_, header.get(), header_size); | 658 memcpy(shared_memory_address_, header.get(), header_size); |
658 uint32_t offset = header_size; | 659 uint32_t offset = header_size; |
(...skipping 1321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1980 .Times(1) | 1981 .Times(1) |
1981 .RetiresOnSaturation(); | 1982 .RetiresOnSaturation(); |
1982 EXPECT_CALL(*gl_, PixelStorei(GL_UNPACK_IMAGE_HEIGHT, 0)) | 1983 EXPECT_CALL(*gl_, PixelStorei(GL_UNPACK_IMAGE_HEIGHT, 0)) |
1983 .Times(1) | 1984 .Times(1) |
1984 .RetiresOnSaturation(); | 1985 .RetiresOnSaturation(); |
1985 } | 1986 } |
1986 } | 1987 } |
1987 | 1988 |
1988 GLES2DecoderWithShaderTestBase::MockCommandBufferEngine:: | 1989 GLES2DecoderWithShaderTestBase::MockCommandBufferEngine:: |
1989 MockCommandBufferEngine() { | 1990 MockCommandBufferEngine() { |
1990 | 1991 std::unique_ptr<base::SharedMemory> shm(new base::SharedMemory()); |
1991 scoped_ptr<base::SharedMemory> shm(new base::SharedMemory()); | |
1992 shm->CreateAndMapAnonymous(kSharedBufferSize); | 1992 shm->CreateAndMapAnonymous(kSharedBufferSize); |
1993 valid_buffer_ = MakeBufferFromSharedMemory(std::move(shm), kSharedBufferSize); | 1993 valid_buffer_ = MakeBufferFromSharedMemory(std::move(shm), kSharedBufferSize); |
1994 | 1994 |
1995 ClearSharedMemory(); | 1995 ClearSharedMemory(); |
1996 } | 1996 } |
1997 | 1997 |
1998 GLES2DecoderWithShaderTestBase::MockCommandBufferEngine:: | 1998 GLES2DecoderWithShaderTestBase::MockCommandBufferEngine:: |
1999 ~MockCommandBufferEngine() {} | 1999 ~MockCommandBufferEngine() {} |
2000 | 2000 |
2001 scoped_refptr<gpu::Buffer> | 2001 scoped_refptr<gpu::Buffer> |
(...skipping 30 matching lines...) Expand all Loading... |
2032 SetupDefaultProgram(); | 2032 SetupDefaultProgram(); |
2033 } | 2033 } |
2034 | 2034 |
2035 // Include the auto-generated part of this file. We split this because it means | 2035 // Include the auto-generated part of this file. We split this because it means |
2036 // we can easily edit the non-auto generated parts right here in this file | 2036 // we can easily edit the non-auto generated parts right here in this file |
2037 // instead of having to edit some template or the code generator. | 2037 // instead of having to edit some template or the code generator. |
2038 #include "gpu/command_buffer/service/gles2_cmd_decoder_unittest_0_autogen.h" | 2038 #include "gpu/command_buffer/service/gles2_cmd_decoder_unittest_0_autogen.h" |
2039 | 2039 |
2040 } // namespace gles2 | 2040 } // namespace gles2 |
2041 } // namespace gpu | 2041 } // namespace gpu |
OLD | NEW |