Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(659)

Side by Side Diff: gpu/command_buffer/tests/gl_gpu_memory_buffer_unittest.cc

Issue 1859703002: convert //gpu to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase on master Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
11 #include <memory>
12
11 #include "base/bind.h" 13 #include "base/bind.h"
12 #include "base/memory/ref_counted.h" 14 #include "base/memory/ref_counted.h"
13 #include "base/process/process_handle.h" 15 #include "base/process/process_handle.h"
14 #include "gpu/command_buffer/client/gles2_implementation.h" 16 #include "gpu/command_buffer/client/gles2_implementation.h"
15 #include "gpu/command_buffer/service/command_buffer_service.h" 17 #include "gpu/command_buffer/service/command_buffer_service.h"
16 #include "gpu/command_buffer/service/image_manager.h" 18 #include "gpu/command_buffer/service/image_manager.h"
17 #include "gpu/command_buffer/tests/gl_manager.h" 19 #include "gpu/command_buffer/tests/gl_manager.h"
18 #include "gpu/command_buffer/tests/gl_test_utils.h" 20 #include "gpu/command_buffer/tests/gl_test_utils.h"
19 #include "testing/gmock/include/gmock/gmock.h" 21 #include "testing/gmock/include/gmock/gmock.h"
20 #include "testing/gtest/include/gtest/gtest.h" 22 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 GLuint texture_id = 0; 167 GLuint texture_id = 0;
166 glGenTextures(1, &texture_id); 168 glGenTextures(1, &texture_id);
167 ASSERT_NE(0u, texture_id); 169 ASSERT_NE(0u, texture_id);
168 glBindTexture(GL_TEXTURE_2D, texture_id); 170 glBindTexture(GL_TEXTURE_2D, texture_id);
169 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); 171 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); 172 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
171 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); 173 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
172 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); 174 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
173 175
174 // Create the gpu memory buffer. 176 // Create the gpu memory buffer.
175 scoped_ptr<gfx::GpuMemoryBuffer> buffer(gl_.CreateGpuMemoryBuffer( 177 std::unique_ptr<gfx::GpuMemoryBuffer> buffer(gl_.CreateGpuMemoryBuffer(
176 gfx::Size(kImageWidth, kImageHeight), GetParam())); 178 gfx::Size(kImageWidth, kImageHeight), GetParam()));
177 179
178 // Map buffer for writing. 180 // Map buffer for writing.
179 ASSERT_TRUE(buffer->Map()); 181 ASSERT_TRUE(buffer->Map());
180 ASSERT_NE(nullptr, buffer->memory(0)); 182 ASSERT_NE(nullptr, buffer->memory(0));
181 ASSERT_NE(0, buffer->stride(0)); 183 ASSERT_NE(0, buffer->stride(0));
182 uint8_t pixel[] = {255u, 0u, 0u, 255u}; 184 uint8_t pixel[] = {255u, 0u, 0u, 255u};
183 185
184 // Assign a value to each pixel. 186 // Assign a value to each pixel.
185 for (int y = 0; y < kImageHeight; ++y) { 187 for (int y = 0; y < kImageHeight; ++y) {
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 240
239 INSTANTIATE_TEST_CASE_P(GpuMemoryBufferTests, 241 INSTANTIATE_TEST_CASE_P(GpuMemoryBufferTests,
240 GpuMemoryBufferTest, 242 GpuMemoryBufferTest,
241 ::testing::Values(gfx::BufferFormat::R_8, 243 ::testing::Values(gfx::BufferFormat::R_8,
242 gfx::BufferFormat::RGBA_4444, 244 gfx::BufferFormat::RGBA_4444,
243 gfx::BufferFormat::RGBA_8888, 245 gfx::BufferFormat::RGBA_8888,
244 gfx::BufferFormat::BGRA_8888)); 246 gfx::BufferFormat::BGRA_8888));
245 247
246 } // namespace gles2 248 } // namespace gles2
247 } // namespace gpu 249 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/tests/gl_fence_sync_unittest.cc ('k') | gpu/command_buffer/tests/gl_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698