OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <GLES2/gl2.h> | 5 #include <GLES2/gl2.h> |
6 #include <GLES2/gl2chromium.h> | 6 #include <GLES2/gl2chromium.h> |
7 #include <GLES2/gl2ext.h> | 7 #include <GLES2/gl2ext.h> |
8 #include <GLES2/gl2extchromium.h> | 8 #include <GLES2/gl2extchromium.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
no sievers
2016/04/05 19:02:41
#include <memory>
Mostyn Bramley-Moore
2016/04/05 21:35:32
Done.
| |
11 #include "base/bind.h" | 11 #include "base/bind.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "base/process/process_handle.h" | 13 #include "base/process/process_handle.h" |
14 #include "gpu/command_buffer/client/gles2_implementation.h" | 14 #include "gpu/command_buffer/client/gles2_implementation.h" |
15 #include "gpu/command_buffer/service/command_buffer_service.h" | 15 #include "gpu/command_buffer/service/command_buffer_service.h" |
16 #include "gpu/command_buffer/service/image_manager.h" | 16 #include "gpu/command_buffer/service/image_manager.h" |
17 #include "gpu/command_buffer/tests/gl_manager.h" | 17 #include "gpu/command_buffer/tests/gl_manager.h" |
18 #include "gpu/command_buffer/tests/gl_test_utils.h" | 18 #include "gpu/command_buffer/tests/gl_test_utils.h" |
19 #include "testing/gmock/include/gmock/gmock.h" | 19 #include "testing/gmock/include/gmock/gmock.h" |
20 #include "testing/gtest/include/gtest/gtest.h" | 20 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
165 GLuint texture_id = 0; | 165 GLuint texture_id = 0; |
166 glGenTextures(1, &texture_id); | 166 glGenTextures(1, &texture_id); |
167 ASSERT_NE(0u, texture_id); | 167 ASSERT_NE(0u, texture_id); |
168 glBindTexture(GL_TEXTURE_2D, texture_id); | 168 glBindTexture(GL_TEXTURE_2D, texture_id); |
169 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); | 169 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); |
170 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); | 170 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); |
171 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); | 171 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); |
172 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); | 172 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); |
173 | 173 |
174 // Create the gpu memory buffer. | 174 // Create the gpu memory buffer. |
175 scoped_ptr<gfx::GpuMemoryBuffer> buffer(gl_.CreateGpuMemoryBuffer( | 175 std::unique_ptr<gfx::GpuMemoryBuffer> buffer(gl_.CreateGpuMemoryBuffer( |
176 gfx::Size(kImageWidth, kImageHeight), GetParam())); | 176 gfx::Size(kImageWidth, kImageHeight), GetParam())); |
177 | 177 |
178 // Map buffer for writing. | 178 // Map buffer for writing. |
179 ASSERT_TRUE(buffer->Map()); | 179 ASSERT_TRUE(buffer->Map()); |
180 ASSERT_NE(nullptr, buffer->memory(0)); | 180 ASSERT_NE(nullptr, buffer->memory(0)); |
181 ASSERT_NE(0, buffer->stride(0)); | 181 ASSERT_NE(0, buffer->stride(0)); |
182 uint8_t pixel[] = {255u, 0u, 0u, 255u}; | 182 uint8_t pixel[] = {255u, 0u, 0u, 255u}; |
183 | 183 |
184 // Assign a value to each pixel. | 184 // Assign a value to each pixel. |
185 for (int y = 0; y < kImageHeight; ++y) { | 185 for (int y = 0; y < kImageHeight; ++y) { |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
238 | 238 |
239 INSTANTIATE_TEST_CASE_P(GpuMemoryBufferTests, | 239 INSTANTIATE_TEST_CASE_P(GpuMemoryBufferTests, |
240 GpuMemoryBufferTest, | 240 GpuMemoryBufferTest, |
241 ::testing::Values(gfx::BufferFormat::R_8, | 241 ::testing::Values(gfx::BufferFormat::R_8, |
242 gfx::BufferFormat::RGBA_4444, | 242 gfx::BufferFormat::RGBA_4444, |
243 gfx::BufferFormat::RGBA_8888, | 243 gfx::BufferFormat::RGBA_8888, |
244 gfx::BufferFormat::BGRA_8888)); | 244 gfx::BufferFormat::BGRA_8888)); |
245 | 245 |
246 } // namespace gles2 | 246 } // namespace gles2 |
247 } // namespace gpu | 247 } // namespace gpu |
OLD | NEW |