mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-06-16 12:58:33 +02:00
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.
This commit is contained in:
@ -2,11 +2,14 @@
|
||||
// Licensed under GPLv2+
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include "VideoBackends/Vulkan/VKPipeline.h"
|
||||
|
||||
#include <array>
|
||||
|
||||
#include "Common/Assert.h"
|
||||
#include "Common/MsgHandler.h"
|
||||
|
||||
#include "VideoBackends/Vulkan/ObjectCache.h"
|
||||
#include "VideoBackends/Vulkan/VKPipeline.h"
|
||||
#include "VideoBackends/Vulkan/VKShader.h"
|
||||
#include "VideoBackends/Vulkan/VKTexture.h"
|
||||
#include "VideoBackends/Vulkan/VertexFormat.h"
|
||||
@ -346,13 +349,15 @@ std::unique_ptr<VKPipeline> VKPipeline::Create(const AbstractPipelineConfig& con
|
||||
};
|
||||
|
||||
// Set viewport and scissor dynamic state so we can change it elsewhere.
|
||||
static const VkDynamicState dynamic_states[] = {VK_DYNAMIC_STATE_VIEWPORT,
|
||||
VK_DYNAMIC_STATE_SCISSOR};
|
||||
static const std::array<VkDynamicState, 2> dynamic_states{
|
||||
VK_DYNAMIC_STATE_VIEWPORT,
|
||||
VK_DYNAMIC_STATE_SCISSOR,
|
||||
};
|
||||
static const VkPipelineDynamicStateCreateInfo dynamic_state = {
|
||||
VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO, nullptr,
|
||||
0, // VkPipelineDynamicStateCreateFlags flags
|
||||
static_cast<u32>(ArraySize(dynamic_states)), // uint32_t dynamicStateCount
|
||||
dynamic_states // const VkDynamicState* pDynamicStates
|
||||
0, // VkPipelineDynamicStateCreateFlags flags
|
||||
static_cast<u32>(dynamic_states.size()), // uint32_t dynamicStateCount
|
||||
dynamic_states.data() // const VkDynamicState* pDynamicStates
|
||||
};
|
||||
|
||||
// Combine to full pipeline info structure.
|
||||
|
Reference in New Issue
Block a user