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_command_pool.h" | 5 #include "gpu/vulkan/vulkan_command_pool.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "gpu/vulkan/vulkan_command_buffer.h" | 8 #include "gpu/vulkan/vulkan_command_buffer.h" |
9 #include "gpu/vulkan/vulkan_device_queue.h" | 9 #include "gpu/vulkan/vulkan_device_queue.h" |
10 #include "gpu/vulkan/vulkan_implementation.h" | 10 #include "gpu/vulkan/vulkan_implementation.h" |
(...skipping 28 matching lines...) Loading... |
39 } | 39 } |
40 | 40 |
41 void VulkanCommandPool::Destroy() { | 41 void VulkanCommandPool::Destroy() { |
42 DCHECK_EQ(0u, command_buffer_count_); | 42 DCHECK_EQ(0u, command_buffer_count_); |
43 if (VK_NULL_HANDLE != handle_) { | 43 if (VK_NULL_HANDLE != handle_) { |
44 vkDestroyCommandPool(device_queue_->GetVulkanDevice(), handle_, nullptr); | 44 vkDestroyCommandPool(device_queue_->GetVulkanDevice(), handle_, nullptr); |
45 handle_ = VK_NULL_HANDLE; | 45 handle_ = VK_NULL_HANDLE; |
46 } | 46 } |
47 } | 47 } |
48 | 48 |
49 scoped_ptr<VulkanCommandBuffer> | 49 std::unique_ptr<VulkanCommandBuffer> |
50 VulkanCommandPool::CreatePrimaryCommandBuffer() { | 50 VulkanCommandPool::CreatePrimaryCommandBuffer() { |
51 scoped_ptr<VulkanCommandBuffer> command_buffer( | 51 std::unique_ptr<VulkanCommandBuffer> command_buffer( |
52 new VulkanCommandBuffer(device_queue_, this, true)); | 52 new VulkanCommandBuffer(device_queue_, this, true)); |
53 if (!command_buffer->Initialize()) | 53 if (!command_buffer->Initialize()) |
54 return nullptr; | 54 return nullptr; |
55 | 55 |
56 return command_buffer; | 56 return command_buffer; |
57 } | 57 } |
58 | 58 |
59 scoped_ptr<VulkanCommandBuffer> | 59 std::unique_ptr<VulkanCommandBuffer> |
60 VulkanCommandPool::CreateSecondaryCommandBuffer() { | 60 VulkanCommandPool::CreateSecondaryCommandBuffer() { |
61 scoped_ptr<VulkanCommandBuffer> command_buffer( | 61 std::unique_ptr<VulkanCommandBuffer> command_buffer( |
62 new VulkanCommandBuffer(device_queue_, this, false)); | 62 new VulkanCommandBuffer(device_queue_, this, false)); |
63 if (!command_buffer->Initialize()) | 63 if (!command_buffer->Initialize()) |
64 return nullptr; | 64 return nullptr; |
65 | 65 |
66 return command_buffer; | 66 return command_buffer; |
67 } | 67 } |
68 | 68 |
69 void VulkanCommandPool::IncrementCommandBufferCount() { | 69 void VulkanCommandPool::IncrementCommandBufferCount() { |
70 command_buffer_count_++; | 70 command_buffer_count_++; |
71 } | 71 } |
72 | 72 |
73 void VulkanCommandPool::DecrementCommandBufferCount() { | 73 void VulkanCommandPool::DecrementCommandBufferCount() { |
74 DCHECK_LT(0u, command_buffer_count_); | 74 DCHECK_LT(0u, command_buffer_count_); |
75 command_buffer_count_--; | 75 command_buffer_count_--; |
76 } | 76 } |
77 | 77 |
78 } // namespace gpu | 78 } // namespace gpu |
OLD | NEW |