Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2015 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 <stddef.h> | 5 #include <stddef.h> |
| 6 #include <stdint.h> | 6 #include <stdint.h> |
| 7 | 7 |
|
no sievers
2016/04/05 19:02:40
#include <memory>
Mostyn Bramley-Moore
2016/04/05 21:35:30
Done.
| |
| 8 #include "gpu/command_buffer/client/program_info_manager.h" | 8 #include "gpu/command_buffer/client/program_info_manager.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 | 10 |
| 11 namespace { | 11 namespace { |
| 12 | 12 |
| 13 uint32_t ComputeOffset(const void* start, const void* position) { | 13 uint32_t ComputeOffset(const void* start, const void* position) { |
| 14 return static_cast<const uint8_t*>(position) - | 14 return static_cast<const uint8_t*>(position) - |
| 15 static_cast<const uint8_t*>(start); | 15 static_cast<const uint8_t*>(start); |
| 16 } | 16 } |
| 17 | 17 |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 158 data->entry[0].name_offset = ComputeOffset(data, data->name0); | 158 data->entry[0].name_offset = ComputeOffset(data, data->name0); |
| 159 data->entry[0].name_length = arraysize(data->name0); | 159 data->entry[0].name_length = arraysize(data->name0); |
| 160 data->entry[1].size = 2; | 160 data->entry[1].size = 2; |
| 161 data->entry[1].type = GL_FLOAT; | 161 data->entry[1].type = GL_FLOAT; |
| 162 data->entry[1].name_offset = ComputeOffset(data, data->name1); | 162 data->entry[1].name_offset = ComputeOffset(data, data->name1); |
| 163 data->entry[1].name_length = arraysize(data->name1); | 163 data->entry[1].name_length = arraysize(data->name1); |
| 164 memcpy(data->name0, kName[0], arraysize(data->name0)); | 164 memcpy(data->name0, kName[0], arraysize(data->name0)); |
| 165 memcpy(data->name1, kName[1], arraysize(data->name1)); | 165 memcpy(data->name1, kName[1], arraysize(data->name1)); |
| 166 } | 166 } |
| 167 | 167 |
| 168 scoped_ptr<ProgramInfoManager> program_info_manager_; | 168 std::unique_ptr<ProgramInfoManager> program_info_manager_; |
| 169 Program* program_; | 169 Program* program_; |
| 170 }; | 170 }; |
| 171 | 171 |
| 172 TEST_F(ProgramInfoManagerTest, UpdateES2) { | 172 TEST_F(ProgramInfoManagerTest, UpdateES2) { |
| 173 ProgramES2Data data; | 173 ProgramES2Data data; |
| 174 SetupProgramES2Data(&data); | 174 SetupProgramES2Data(&data); |
| 175 const std::string kNames[] = { data.uniform_name0, data.uniform_name1 }; | 175 const std::string kNames[] = { data.uniform_name0, data.uniform_name1 }; |
| 176 const int32_t* kLocs[] = { data.uniform_loc0, data.uniform_loc1 }; | 176 const int32_t* kLocs[] = { data.uniform_loc0, data.uniform_loc1 }; |
| 177 std::vector<int8_t> result(sizeof(data)); | 177 std::vector<int8_t> result(sizeof(data)); |
| 178 memcpy(&result[0], &data, sizeof(data)); | 178 memcpy(&result[0], &data, sizeof(data)); |
| (...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 549 EXPECT_EQ(data_es2.uniforms[ii].size, size[ii]); | 549 EXPECT_EQ(data_es2.uniforms[ii].size, size[ii]); |
| 550 EXPECT_EQ(data_es2.uniforms[ii].type, static_cast<uint32_t>(type[ii])); | 550 EXPECT_EQ(data_es2.uniforms[ii].type, static_cast<uint32_t>(type[ii])); |
| 551 EXPECT_EQ(data_es2.uniforms[ii].name_length + 1, | 551 EXPECT_EQ(data_es2.uniforms[ii].name_length + 1, |
| 552 static_cast<uint32_t>(name_length[ii])); | 552 static_cast<uint32_t>(name_length[ii])); |
| 553 } | 553 } |
| 554 } | 554 } |
| 555 | 555 |
| 556 } // namespace gles2 | 556 } // namespace gles2 |
| 557 } // namespace gpu | 557 } // namespace gpu |
| 558 | 558 |
| OLD | NEW |