diff options
Diffstat (limited to 'src/video_core')
| -rw-r--r-- | src/video_core/renderer_vulkan/vk_resource_manager.cpp | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/src/video_core/renderer_vulkan/vk_resource_manager.cpp b/src/video_core/renderer_vulkan/vk_resource_manager.cpp index dc06f545a..f19330a36 100644 --- a/src/video_core/renderer_vulkan/vk_resource_manager.cpp +++ b/src/video_core/renderer_vulkan/vk_resource_manager.cpp | |||
| @@ -18,33 +18,32 @@ namespace { | |||
| 18 | constexpr std::size_t COMMAND_BUFFER_POOL_SIZE = 0x1000; | 18 | constexpr std::size_t COMMAND_BUFFER_POOL_SIZE = 0x1000; |
| 19 | constexpr std::size_t FENCES_GROW_STEP = 0x40; | 19 | constexpr std::size_t FENCES_GROW_STEP = 0x40; |
| 20 | 20 | ||
| 21 | VkFenceCreateInfo BuildFenceCreateInfo() { | 21 | constexpr VkFenceCreateInfo BuildFenceCreateInfo() { |
| 22 | VkFenceCreateInfo fence_ci; | 22 | return { |
| 23 | fence_ci.sType = VK_STRUCTURE_TYPE_FENCE_CREATE_INFO; | 23 | .sType = VK_STRUCTURE_TYPE_FENCE_CREATE_INFO, |
| 24 | fence_ci.pNext = nullptr; | 24 | .pNext = nullptr, |
| 25 | fence_ci.flags = 0; | 25 | .flags = 0, |
| 26 | return fence_ci; | 26 | }; |
| 27 | } | 27 | } |
| 28 | 28 | ||
| 29 | } // Anonymous namespace | 29 | } // Anonymous namespace |
| 30 | 30 | ||
| 31 | class CommandBufferPool final : public VKFencedPool { | 31 | class CommandBufferPool final : public VKFencedPool { |
| 32 | public: | 32 | public: |
| 33 | CommandBufferPool(const VKDevice& device) | 33 | explicit CommandBufferPool(const VKDevice& device) |
| 34 | : VKFencedPool(COMMAND_BUFFER_POOL_SIZE), device{device} {} | 34 | : VKFencedPool(COMMAND_BUFFER_POOL_SIZE), device{device} {} |
| 35 | 35 | ||
| 36 | void Allocate(std::size_t begin, std::size_t end) override { | 36 | void Allocate(std::size_t begin, std::size_t end) override { |
| 37 | // Command buffers are going to be commited, recorded, executed every single usage cycle. | 37 | // Command buffers are going to be commited, recorded, executed every single usage cycle. |
| 38 | // They are also going to be reseted when commited. | 38 | // They are also going to be reseted when commited. |
| 39 | VkCommandPoolCreateInfo command_pool_ci; | ||
| 40 | command_pool_ci.sType = VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO; | ||
| 41 | command_pool_ci.pNext = nullptr; | ||
| 42 | command_pool_ci.flags = | ||
| 43 | VK_COMMAND_POOL_CREATE_TRANSIENT_BIT | VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT; | ||
| 44 | command_pool_ci.queueFamilyIndex = device.GetGraphicsFamily(); | ||
| 45 | |||
| 46 | Pool& pool = pools.emplace_back(); | 39 | Pool& pool = pools.emplace_back(); |
| 47 | pool.handle = device.GetLogical().CreateCommandPool(command_pool_ci); | 40 | pool.handle = device.GetLogical().CreateCommandPool({ |
| 41 | .sType = VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO, | ||
| 42 | .pNext = nullptr, | ||
| 43 | .flags = VK_COMMAND_POOL_CREATE_TRANSIENT_BIT | | ||
| 44 | VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT, | ||
| 45 | .queueFamilyIndex = device.GetGraphicsFamily(), | ||
| 46 | }); | ||
| 48 | pool.cmdbufs = pool.handle.Allocate(COMMAND_BUFFER_POOL_SIZE); | 47 | pool.cmdbufs = pool.handle.Allocate(COMMAND_BUFFER_POOL_SIZE); |
| 49 | } | 48 | } |
| 50 | 49 | ||