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

Side by Side Diff: gpu/vulkan/tests/vulkan_test.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
« no previous file with comments | « gpu/tools/compositor_model_bench/shaders.cc ('k') | gpu/vulkan/vulkan_command_buffer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 <memory>
6
5 #include "gpu/vulkan/tests/native_window.h" 7 #include "gpu/vulkan/tests/native_window.h"
6 #include "gpu/vulkan/vulkan_command_buffer.h" 8 #include "gpu/vulkan/vulkan_command_buffer.h"
7 #include "gpu/vulkan/vulkan_device_queue.h" 9 #include "gpu/vulkan/vulkan_device_queue.h"
8 #include "gpu/vulkan/vulkan_render_pass.h" 10 #include "gpu/vulkan/vulkan_render_pass.h"
9 #include "gpu/vulkan/vulkan_surface.h" 11 #include "gpu/vulkan/vulkan_surface.h"
10 #include "gpu/vulkan/vulkan_swap_chain.h" 12 #include "gpu/vulkan/vulkan_swap_chain.h"
11 #include "testing/gtest/include/gtest/gtest.h" 13 #include "testing/gtest/include/gtest/gtest.h"
12 #include "ui/gfx/geometry/rect.h" 14 #include "ui/gfx/geometry/rect.h"
13 15
14 // This file tests basic vulkan initialization steps. 16 // This file tests basic vulkan initialization steps.
(...skipping 18 matching lines...) Expand all
33 35
34 gfx::AcceleratedWidget window() const { return window_; } 36 gfx::AcceleratedWidget window() const { return window_; }
35 VulkanDeviceQueue* GetDeviceQueue() { return &device_queue_; } 37 VulkanDeviceQueue* GetDeviceQueue() { return &device_queue_; }
36 38
37 private: 39 private:
38 VulkanDeviceQueue device_queue_; 40 VulkanDeviceQueue device_queue_;
39 gfx::AcceleratedWidget window_ = gfx::kNullAcceleratedWidget; 41 gfx::AcceleratedWidget window_ = gfx::kNullAcceleratedWidget;
40 }; 42 };
41 43
42 TEST_F(BasicVulkanTest, BasicVulkanSurface) { 44 TEST_F(BasicVulkanTest, BasicVulkanSurface) {
43 scoped_ptr<VulkanSurface> surface = 45 std::unique_ptr<VulkanSurface> surface =
44 VulkanSurface::CreateViewSurface(window()); 46 VulkanSurface::CreateViewSurface(window());
45 EXPECT_TRUE(surface); 47 EXPECT_TRUE(surface);
46 EXPECT_TRUE(surface->Initialize(GetDeviceQueue(), 48 EXPECT_TRUE(surface->Initialize(GetDeviceQueue(),
47 VulkanSurface::DEFAULT_SURFACE_FORMAT)); 49 VulkanSurface::DEFAULT_SURFACE_FORMAT));
48 surface->Destroy(); 50 surface->Destroy();
49 } 51 }
50 52
51 TEST_F(BasicVulkanTest, EmptyVulkanSwaps) { 53 TEST_F(BasicVulkanTest, EmptyVulkanSwaps) {
52 scoped_ptr<VulkanSurface> surface = 54 std::unique_ptr<VulkanSurface> surface =
53 VulkanSurface::CreateViewSurface(window()); 55 VulkanSurface::CreateViewSurface(window());
54 ASSERT_TRUE(surface); 56 ASSERT_TRUE(surface);
55 ASSERT_TRUE(surface->Initialize(GetDeviceQueue(), 57 ASSERT_TRUE(surface->Initialize(GetDeviceQueue(),
56 VulkanSurface::DEFAULT_SURFACE_FORMAT)); 58 VulkanSurface::DEFAULT_SURFACE_FORMAT));
57 59
58 // First swap is a special case, call it first to get better errors. 60 // First swap is a special case, call it first to get better errors.
59 EXPECT_EQ(gfx::SwapResult::SWAP_ACK, surface->SwapBuffers()); 61 EXPECT_EQ(gfx::SwapResult::SWAP_ACK, surface->SwapBuffers());
60 62
61 // Also make sure we can swap multiple times. 63 // Also make sure we can swap multiple times.
62 for (int i = 0; i < 10; ++i) { 64 for (int i = 0; i < 10; ++i) {
63 EXPECT_EQ(gfx::SwapResult::SWAP_ACK, surface->SwapBuffers()); 65 EXPECT_EQ(gfx::SwapResult::SWAP_ACK, surface->SwapBuffers());
64 } 66 }
65 surface->Finish(); 67 surface->Finish();
66 surface->Destroy(); 68 surface->Destroy();
67 } 69 }
68 70
69 TEST_F(BasicVulkanTest, BasicRenderPass) { 71 TEST_F(BasicVulkanTest, BasicRenderPass) {
70 scoped_ptr<VulkanSurface> surface = 72 std::unique_ptr<VulkanSurface> surface =
71 VulkanSurface::CreateViewSurface(window()); 73 VulkanSurface::CreateViewSurface(window());
72 ASSERT_TRUE(surface); 74 ASSERT_TRUE(surface);
73 ASSERT_TRUE(surface->Initialize(GetDeviceQueue(), 75 ASSERT_TRUE(surface->Initialize(GetDeviceQueue(),
74 VulkanSurface::DEFAULT_SURFACE_FORMAT)); 76 VulkanSurface::DEFAULT_SURFACE_FORMAT));
75 VulkanSwapChain* swap_chain = surface->GetSwapChain(); 77 VulkanSwapChain* swap_chain = surface->GetSwapChain();
76 78
77 VulkanRenderPass::RenderPassData render_pass_data; 79 VulkanRenderPass::RenderPassData render_pass_data;
78 80
79 // There is a single attachment which transitions present -> color -> present. 81 // There is a single attachment which transitions present -> color -> present.
80 render_pass_data.attachments.resize(1); 82 render_pass_data.attachments.resize(1);
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 123
122 EXPECT_EQ(gfx::SwapResult::SWAP_ACK, surface->SwapBuffers()); 124 EXPECT_EQ(gfx::SwapResult::SWAP_ACK, surface->SwapBuffers());
123 } 125 }
124 126
125 surface->Finish(); 127 surface->Finish();
126 render_pass.Destroy(); 128 render_pass.Destroy();
127 surface->Destroy(); 129 surface->Destroy();
128 } 130 }
129 131
130 } // namespace gpu 132 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/tools/compositor_model_bench/shaders.cc ('k') | gpu/vulkan/vulkan_command_buffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698