summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Lioncash2020-07-16 19:02:35 -0400
committerGravatar Lioncash2020-07-16 19:02:35 -0400
commit772b6e4d28c9266087c23e4694fda3f1e99f651f (patch)
treeee35cdbc1e50c0b21ca807805809fea30d535e87 /src
parentvk_renderpass_cache: Make use of designated initializers where applicable (diff)
downloadyuzu-772b6e4d28c9266087c23e4694fda3f1e99f651f.tar.gz
yuzu-772b6e4d28c9266087c23e4694fda3f1e99f651f.tar.xz
yuzu-772b6e4d28c9266087c23e4694fda3f1e99f651f.zip
vk_resource_manager: Make use of designated initializers where applicable
Diffstat (limited to 'src')
-rw-r--r--src/video_core/renderer_vulkan/vk_resource_manager.cpp29
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 {
18constexpr std::size_t COMMAND_BUFFER_POOL_SIZE = 0x1000; 18constexpr std::size_t COMMAND_BUFFER_POOL_SIZE = 0x1000;
19constexpr std::size_t FENCES_GROW_STEP = 0x40; 19constexpr std::size_t FENCES_GROW_STEP = 0x40;
20 20
21VkFenceCreateInfo BuildFenceCreateInfo() { 21constexpr 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
31class CommandBufferPool final : public VKFencedPool { 31class CommandBufferPool final : public VKFencedPool {
32public: 32public:
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