| OLD | NEW |
| 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 25 matching lines...) Expand all Loading... |
| 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 std::unique_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. | |
| 47 VkImageSubresourceRange image_subresource_range = {}; | |
| 48 image_subresource_range.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; | |
| 49 image_subresource_range.baseMipLevel = 0; | |
| 50 image_subresource_range.levelCount = 1; | |
| 51 image_subresource_range.baseArrayLayer = 0; | |
| 52 image_subresource_range.layerCount = 1; | |
| 53 | |
| 54 // Submit our command buffer for the current buffer. | 46 // Submit our command buffer for the current buffer. |
| 55 if (!current_image_data->command_buffer->Submit( | 47 if (!current_image_data->command_buffer->Submit( |
| 56 1, ¤t_image_data->present_semaphore, 1, | 48 1, ¤t_image_data->present_semaphore, 1, |
| 57 ¤t_image_data->render_semaphore)) { | 49 ¤t_image_data->render_semaphore)) { |
| 58 return gfx::SwapResult::SWAP_FAILED; | 50 return gfx::SwapResult::SWAP_FAILED; |
| 59 } | 51 } |
| 60 | 52 |
| 61 // Queue the present. | 53 // Queue the present. |
| 62 VkPresentInfoKHR present_info = {}; | 54 VkPresentInfoKHR present_info = {}; |
| 63 present_info.sType = VK_STRUCTURE_TYPE_PRESENT_INFO_KHR; | 55 present_info.sType = VK_STRUCTURE_TYPE_PRESENT_INFO_KHR; |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 command_pool_->Destroy(); | 284 command_pool_->Destroy(); |
| 293 command_pool_.reset(); | 285 command_pool_.reset(); |
| 294 } | 286 } |
| 295 } | 287 } |
| 296 | 288 |
| 297 VulkanSwapChain::ImageData::ImageData() {} | 289 VulkanSwapChain::ImageData::ImageData() {} |
| 298 | 290 |
| 299 VulkanSwapChain::ImageData::~ImageData() {} | 291 VulkanSwapChain::ImageData::~ImageData() {} |
| 300 | 292 |
| 301 } // namespace gpu | 293 } // namespace gpu |
| OLD | NEW |