summaryrefslogtreecommitdiff
path: root/Source/Core/VideoBackends/Vulkan/CommandBufferManager.cpp
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2019-06-01 07:55:09 -0400
committerLioncash <mathew1800@gmail.com>2019-06-01 10:07:57 -0400
commita9663669dc1037a04e37ae30efe18c0650547ac5 (patch)
treeb0bafacb909c3360951bb6b2781a94b97a9284be /Source/Core/VideoBackends/Vulkan/CommandBufferManager.cpp
parenta4837a5c5dc5d71f4b93dcb2fd5b80c5cfab381a (diff)
Common/CommonFuncs: Remove now-unneccessary ArraySize function
Since C++17, non-member std::size() is present in the standard library which also operates on regular C arrays. Given that, we can just replace usages of ArraySize with that where applicable. In many cases, we can just change the actual C array ArraySize() was called on into a std::array and just use its .size() member function instead. In some other cases, we can collapse the loops they were used in, into a ranged-for loop, eliminating the need for en explicit bounds query.
Diffstat (limited to 'Source/Core/VideoBackends/Vulkan/CommandBufferManager.cpp')
-rw-r--r--Source/Core/VideoBackends/Vulkan/CommandBufferManager.cpp34
1 files changed, 19 insertions, 15 deletions
diff --git a/Source/Core/VideoBackends/Vulkan/CommandBufferManager.cpp b/Source/Core/VideoBackends/Vulkan/CommandBufferManager.cpp
index ea6eb6e0ca..22f97b8888 100644
--- a/Source/Core/VideoBackends/Vulkan/CommandBufferManager.cpp
+++ b/Source/Core/VideoBackends/Vulkan/CommandBufferManager.cpp
@@ -2,14 +2,14 @@
// Licensed under GPLv2+
// Refer to the license.txt file included.
-#include <algorithm>
+#include "VideoBackends/Vulkan/CommandBufferManager.h"
+
+#include <array>
#include <cstdint>
#include "Common/Assert.h"
-#include "Common/CommonFuncs.h"
#include "Common/MsgHandler.h"
-#include "VideoBackends/Vulkan/CommandBufferManager.h"
#include "VideoBackends/Vulkan/VulkanContext.h"
namespace Vulkan
@@ -94,18 +94,22 @@ bool CommandBufferManager::CreateCommandBuffers()
}
// TODO: A better way to choose the number of descriptors.
- VkDescriptorPoolSize pool_sizes[] = {{VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC, 500000},
- {VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 500000},
- {VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 16},
- {VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER, 16384},
- {VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, 16384}};
-
- VkDescriptorPoolCreateInfo pool_create_info = {VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO,
- nullptr,
- 0,
- 100000, // tweak this
- static_cast<u32>(ArraySize(pool_sizes)),
- pool_sizes};
+ const std::array<VkDescriptorPoolSize, 5> pool_sizes{{
+ {VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC, 500000},
+ {VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 500000},
+ {VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 16},
+ {VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER, 16384},
+ {VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, 16384},
+ }};
+
+ const VkDescriptorPoolCreateInfo pool_create_info = {
+ VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO,
+ nullptr,
+ 0,
+ 100000, // tweak this
+ static_cast<u32>(pool_sizes.size()),
+ pool_sizes.data(),
+ };
res = vkCreateDescriptorPool(device, &pool_create_info, nullptr, &resources.descriptor_pool);
if (res != VK_SUCCESS)