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