From a9663669dc1037a04e37ae30efe18c0650547ac5 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sat, 1 Jun 2019 07:55:09 -0400 Subject: 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. --- .../VideoBackends/Vulkan/CommandBufferManager.cpp | 34 ++++++++++++---------- 1 file changed, 19 insertions(+), 15 deletions(-) (limited to 'Source/Core/VideoBackends/Vulkan/CommandBufferManager.cpp') 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 +#include "VideoBackends/Vulkan/CommandBufferManager.h" + +#include #include #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(ArraySize(pool_sizes)), - pool_sizes}; + const std::array 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(pool_sizes.size()), + pool_sizes.data(), + }; res = vkCreateDescriptorPool(device, &pool_create_info, nullptr, &resources.descriptor_pool); if (res != VK_SUCCESS) -- cgit v1.2.3