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

Side by Side Diff: gpu/vulkan/vulkan_swap_chain.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/vulkan/vulkan_swap_chain.h ('k') | media/gpu/ipc/client/gpu_jpeg_decode_accelerator_host.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 (c) 2016 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 "gpu/vulkan/vulkan_swap_chain.h" 5 #include "gpu/vulkan/vulkan_swap_chain.h"
6 6
7 #include "gpu/vulkan/vulkan_command_buffer.h" 7 #include "gpu/vulkan/vulkan_command_buffer.h"
8 #include "gpu/vulkan/vulkan_command_pool.h" 8 #include "gpu/vulkan/vulkan_command_pool.h"
9 #include "gpu/vulkan/vulkan_device_queue.h" 9 #include "gpu/vulkan/vulkan_device_queue.h"
10 #include "gpu/vulkan/vulkan_image_view.h" 10 #include "gpu/vulkan/vulkan_image_view.h"
(...skipping 23 matching lines...) Expand all
34 DestroySwapImages(); 34 DestroySwapImages();
35 DestroySwapChain(); 35 DestroySwapChain();
36 } 36 }
37 37
38 gfx::SwapResult VulkanSwapChain::SwapBuffers() { 38 gfx::SwapResult VulkanSwapChain::SwapBuffers() {
39 VkResult result = VK_SUCCESS; 39 VkResult result = VK_SUCCESS;
40 40
41 VkDevice device = device_queue_->GetVulkanDevice(); 41 VkDevice device = device_queue_->GetVulkanDevice();
42 VkQueue queue = device_queue_->GetVulkanQueue(); 42 VkQueue queue = device_queue_->GetVulkanQueue();
43 43
44 scoped_ptr<ImageData>& current_image_data = images_[current_image_]; 44 std::unique_ptr<ImageData>& current_image_data = images_[current_image_];
45 45
46 // Default image subresource range. 46 // Default image subresource range.
47 VkImageSubresourceRange image_subresource_range = {}; 47 VkImageSubresourceRange image_subresource_range = {};
48 image_subresource_range.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; 48 image_subresource_range.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
49 image_subresource_range.baseMipLevel = 0; 49 image_subresource_range.baseMipLevel = 0;
50 image_subresource_range.levelCount = 1; 50 image_subresource_range.levelCount = 1;
51 image_subresource_range.baseArrayLayer = 0; 51 image_subresource_range.baseArrayLayer = 0;
52 image_subresource_range.layerCount = 1; 52 image_subresource_range.layerCount = 1;
53 53
54 // Submit our command buffer for the current buffer. 54 // Submit our command buffer for the current buffer.
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 image_memory_barrier.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; 183 image_memory_barrier.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
184 image_memory_barrier.subresourceRange = image_subresource_range; 184 image_memory_barrier.subresourceRange = image_subresource_range;
185 185
186 command_pool_ = device_queue_->CreateCommandPool(); 186 command_pool_ = device_queue_->CreateCommandPool();
187 if (!command_pool_) 187 if (!command_pool_)
188 return false; 188 return false;
189 189
190 images_.resize(image_count); 190 images_.resize(image_count);
191 for (uint32_t i = 0; i < image_count; ++i) { 191 for (uint32_t i = 0; i < image_count; ++i) {
192 images_[i].reset(new ImageData); 192 images_[i].reset(new ImageData);
193 scoped_ptr<ImageData>& image_data = images_[i]; 193 std::unique_ptr<ImageData>& image_data = images_[i];
194 image_data->image = images[i]; 194 image_data->image = images[i];
195 195
196 // Setup semaphores. 196 // Setup semaphores.
197 result = vkCreateSemaphore(device, &semaphore_create_info, nullptr, 197 result = vkCreateSemaphore(device, &semaphore_create_info, nullptr,
198 &image_data->render_semaphore); 198 &image_data->render_semaphore);
199 if (VK_SUCCESS != result) { 199 if (VK_SUCCESS != result) {
200 DLOG(ERROR) << "vkCreateSemaphore(render) failed: " << result; 200 DLOG(ERROR) << "vkCreateSemaphore(render) failed: " << result;
201 return false; 201 return false;
202 } 202 }
203 203
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 } 251 }
252 252
253 void VulkanSwapChain::DestroySwapImages() { 253 void VulkanSwapChain::DestroySwapImages() {
254 VkDevice device = device_queue_->GetVulkanDevice(); 254 VkDevice device = device_queue_->GetVulkanDevice();
255 255
256 if (VK_NULL_HANDLE != next_present_semaphore_) { 256 if (VK_NULL_HANDLE != next_present_semaphore_) {
257 vkDestroySemaphore(device, next_present_semaphore_, nullptr); 257 vkDestroySemaphore(device, next_present_semaphore_, nullptr);
258 next_present_semaphore_ = VK_NULL_HANDLE; 258 next_present_semaphore_ = VK_NULL_HANDLE;
259 } 259 }
260 260
261 for (const scoped_ptr<ImageData>& image_data : images_) { 261 for (const std::unique_ptr<ImageData>& image_data : images_) {
262 if (image_data->command_buffer) { 262 if (image_data->command_buffer) {
263 // Make sure command buffer is done processing. 263 // Make sure command buffer is done processing.
264 image_data->command_buffer->Wait(UINT64_MAX); 264 image_data->command_buffer->Wait(UINT64_MAX);
265 265
266 image_data->command_buffer->Destroy(); 266 image_data->command_buffer->Destroy();
267 image_data->command_buffer.reset(); 267 image_data->command_buffer.reset();
268 } 268 }
269 269
270 // Destroy Image View. 270 // Destroy Image View.
271 if (image_data->image_view) { 271 if (image_data->image_view) {
(...skipping 20 matching lines...) Expand all
292 command_pool_->Destroy(); 292 command_pool_->Destroy();
293 command_pool_.reset(); 293 command_pool_.reset();
294 } 294 }
295 } 295 }
296 296
297 VulkanSwapChain::ImageData::ImageData() {} 297 VulkanSwapChain::ImageData::ImageData() {}
298 298
299 VulkanSwapChain::ImageData::~ImageData() {} 299 VulkanSwapChain::ImageData::~ImageData() {}
300 300
301 } // namespace gpu 301 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/vulkan/vulkan_swap_chain.h ('k') | media/gpu/ipc/client/gpu_jpeg_decode_accelerator_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698