diff --git a/Common/GPU/D3D11/thin3d_d3d11.cpp b/Common/GPU/D3D11/thin3d_d3d11.cpp index 146dbfaebff3..1559a3cbe8e5 100644 --- a/Common/GPU/D3D11/thin3d_d3d11.cpp +++ b/Common/GPU/D3D11/thin3d_d3d11.cpp @@ -748,7 +748,6 @@ InputLayout *D3D11DrawContext::CreateInputLayout(const InputLayoutDesc &desc) { inputLayout->desc = desc; // Translate to D3D11 elements; - inputLayout->elements.reserve(desc.attributes.size()); for (size_t i = 0; i < desc.attributes.size(); i++) { D3D11_INPUT_ELEMENT_DESC el; el.AlignedByteOffset = desc.attributes[i].offset; @@ -1143,7 +1142,6 @@ Pipeline *D3D11DrawContext::CreateGraphicsPipeline(const PipelineDesc &desc, con std::vector shaders; D3D11ShaderModule *vshader = nullptr; - shaders.reserve(desc.shaders.size()); for (auto iter : desc.shaders) { iter->AddRef(); diff --git a/Common/GPU/GPUBackendCommon.cpp b/Common/GPU/GPUBackendCommon.cpp index c225115ee96b..b53001484dcb 100644 --- a/Common/GPU/GPUBackendCommon.cpp +++ b/Common/GPU/GPUBackendCommon.cpp @@ -11,7 +11,6 @@ static std::set g_pushBuffers; std::vector GetActiveGPUMemoryManagers() { std::vector buffers; std::lock_guard guard(g_pushBufferListMutex); - buffers.reserve(g_pushBuffers.size()); for (auto iter : g_pushBuffers) { buffers.push_back(iter); } diff --git a/Common/GPU/OpenGL/thin3d_gl.cpp b/Common/GPU/OpenGL/thin3d_gl.cpp index 496d195d6d89..cf2eb4eac131 100644 --- a/Common/GPU/OpenGL/thin3d_gl.cpp +++ b/Common/GPU/OpenGL/thin3d_gl.cpp @@ -1435,7 +1435,6 @@ void OpenGLInputLayout::Compile(const InputLayoutDesc &desc) { stride = desc.stride; std::vector entries; - entries.reserve(desc.attributes.size()); for (auto &attr : desc.attributes) { GLRInputLayout::Entry entry; entry.location = attr.location; diff --git a/Common/GPU/Vulkan/VulkanMemory.cpp b/Common/GPU/Vulkan/VulkanMemory.cpp index 42213aa3b466..83588c917945 100644 --- a/Common/GPU/Vulkan/VulkanMemory.cpp +++ b/Common/GPU/Vulkan/VulkanMemory.cpp @@ -38,7 +38,6 @@ static const double PUSH_GARBAGE_COLLECTION_DELAY = 10.0; VulkanPushPool::VulkanPushPool(VulkanContext *vulkan, const char *name, size_t originalBlockSize, VkBufferUsageFlags usage) : vulkan_(vulkan), name_(name), originalBlockSize_(originalBlockSize), usage_(usage) { RegisterGPUMemoryManager(this); - blocks_.reserve(VulkanContext::MAX_INFLIGHT_FRAMES); for (int i = 0; i < VulkanContext::MAX_INFLIGHT_FRAMES; i++) { blocks_.push_back(CreateBlock(originalBlockSize)); blocks_.back().original = true; diff --git a/Common/GPU/Vulkan/VulkanQueueRunner.cpp b/Common/GPU/Vulkan/VulkanQueueRunner.cpp index 12c2ac5ee0c2..9be5da036499 100644 --- a/Common/GPU/Vulkan/VulkanQueueRunner.cpp +++ b/Common/GPU/Vulkan/VulkanQueueRunner.cpp @@ -92,7 +92,6 @@ bool VulkanQueueRunner::CreateSwapchain(VkCommandBuffer cmdInit) { return false; } - swapchainImages_.reserve(swapchainImageCount_); for (uint32_t i = 0; i < swapchainImageCount_; i++) { SwapchainImageData sc_buffer{}; sc_buffer.image = swapchainImages[i]; diff --git a/Common/Input/InputState.cpp b/Common/Input/InputState.cpp index b32c58c41933..4daa5df99083 100644 --- a/Common/Input/InputState.cpp +++ b/Common/Input/InputState.cpp @@ -43,7 +43,6 @@ std::vector tabRightKeys; static std::unordered_map uiFlipAnalogY; static void AppendKeys(std::vector &keys, const std::vector &newKeys) { - keys.reserve(newKeys.size()); for (auto iter = newKeys.begin(); iter != newKeys.end(); ++iter) { keys.push_back(*iter); } diff --git a/Common/Render/ManagedTexture.cpp b/Common/Render/ManagedTexture.cpp index 149aa5dc9d6b..730fd291720d 100644 --- a/Common/Render/ManagedTexture.cpp +++ b/Common/Render/ManagedTexture.cpp @@ -156,7 +156,6 @@ Draw::Texture *CreateTextureFromTempImage(Draw::DrawContext *draw, const TempIma desc.mipLevels = generateMips ? potentialLevels : image.numLevels; desc.generateMips = generateMips && potentialLevels > image.numLevels; desc.tag = name; - desc.initData.reserve(image.numLevels); for (int i = 0; i < image.numLevels; i++) { desc.initData.push_back(image.levels[i]); } diff --git a/Core/Debugger/MemBlockInfo.cpp b/Core/Debugger/MemBlockInfo.cpp index 0f6be382bf13..f727d3a484bf 100644 --- a/Core/Debugger/MemBlockInfo.cpp +++ b/Core/Debugger/MemBlockInfo.cpp @@ -288,12 +288,7 @@ void MemSlabMap::Clear() { MemSlabMap::Slab *MemSlabMap::FindSlab(uint32_t addr) { // Jump ahead using our index. - size_t slabIndex = addr / SLICE_SIZE; - if (slabIndex >= heads_.size()) { - // Shouldn't happen, but apparently can. - return nullptr; - } - Slab *slab = heads_[slabIndex]; + Slab *slab = heads_[addr / SLICE_SIZE]; // We often move forward, so check the last find. if (lastFind_->start > slab->start && lastFind_->start <= addr) slab = lastFind_; diff --git a/Core/HLE/proAdhoc.cpp b/Core/HLE/proAdhoc.cpp index 7863551efb9e..dc7ca03d4df7 100644 --- a/Core/HLE/proAdhoc.cpp +++ b/Core/HLE/proAdhoc.cpp @@ -1891,7 +1891,6 @@ uint32_t getLocalIp(int sock) { static std::vector> InitPrivateIPRanges() { struct sockaddr_in saNet {}, saMask{}; std::vector> ip_ranges; - ip_ranges.reserve(5); if (1 == inet_pton(AF_INET, "192.168.0.0", &(saNet.sin_addr)) && 1 == inet_pton(AF_INET, "255.255.0.0", &(saMask.sin_addr))) ip_ranges.push_back({saNet.sin_addr.s_addr, saMask.sin_addr.s_addr}); diff --git a/Core/MIPS/ARM64/Arm64IRCompSystem.cpp b/Core/MIPS/ARM64/Arm64IRCompSystem.cpp index 16840250f7f0..91a63978f419 100644 --- a/Core/MIPS/ARM64/Arm64IRCompSystem.cpp +++ b/Core/MIPS/ARM64/Arm64IRCompSystem.cpp @@ -386,7 +386,6 @@ void Arm64JitBackend::CompIR_ValidateAddress(IRInst inst) { ANDI2R(SCRATCH1, SCRATCH1, 0x3FFFFFFF, SCRATCH2); std::vector validJumps; - validJumps.reserve(3); FixupBranch unaligned; if (alignment == 2) { diff --git a/Core/MIPS/MIPSAnalyst.cpp b/Core/MIPS/MIPSAnalyst.cpp index da8fe13a39f9..a8ea4280ddff 100644 --- a/Core/MIPS/MIPSAnalyst.cpp +++ b/Core/MIPS/MIPSAnalyst.cpp @@ -1415,7 +1415,6 @@ namespace MIPSAnalyst { std::vector GetOutputRegs(MIPSOpcode op) { std::vector vec; - vec.reserve(3); MIPSInfo info = MIPSGetInfo(op); if (info & OUT_RD) vec.push_back(MIPS_GET_RD(op)); if (info & OUT_RT) vec.push_back(MIPS_GET_RT(op)); diff --git a/Core/MIPS/RiscV/RiscVJit.cpp b/Core/MIPS/RiscV/RiscVJit.cpp index 71d7dae22475..60d5c5f92946 100644 --- a/Core/MIPS/RiscV/RiscVJit.cpp +++ b/Core/MIPS/RiscV/RiscVJit.cpp @@ -83,7 +83,6 @@ bool RiscVJitBackend::CompileBlock(IRBlock *block, int block_num, bool preload) regs_.Start(block); std::vector addresses; - addresses.reserve(block->GetNumInstructions()); for (int i = 0; i < block->GetNumInstructions(); ++i) { const IRInst &inst = block->GetInstructions()[i]; regs_.SetIRIndex(i); diff --git a/Core/MIPS/x86/Jit.cpp b/Core/MIPS/x86/Jit.cpp index 10c1cd01b603..249d12a143c3 100644 --- a/Core/MIPS/x86/Jit.cpp +++ b/Core/MIPS/x86/Jit.cpp @@ -904,7 +904,7 @@ void Jit::CheckMemoryBreakpoint(int instructionOffset, MIPSGPReg rs, int offset) SetJumpTarget(skipCheck); } } else { - const auto &memchecks = CBreakPoints::GetMemCheckRanges(isWrite); + const auto memchecks = CBreakPoints::GetMemCheckRanges(isWrite); bool possible = !memchecks.empty(); if (!possible) return; diff --git a/Core/MIPS/x86/JitSafeMem.cpp b/Core/MIPS/x86/JitSafeMem.cpp index 45f256defd8d..c0644eb53569 100644 --- a/Core/MIPS/x86/JitSafeMem.cpp +++ b/Core/MIPS/x86/JitSafeMem.cpp @@ -455,7 +455,6 @@ void JitSafeMemFuncs::CreateWriteFunc(int bits, const void *fallbackFunc) { void JitSafeMemFuncs::CheckDirectEAX() { // Clear any cache/kernel bits. AND(32, R(EAX), Imm32(0x3FFFFFFF)); - skips_.reserve(3); CMP(32, R(EAX), Imm32(PSP_GetUserMemoryEnd())); FixupBranch tooHighRAM = J_CC(CC_AE); diff --git a/Core/MIPS/x86/X64IRCompSystem.cpp b/Core/MIPS/x86/X64IRCompSystem.cpp index d4435537073b..353f0166a549 100644 --- a/Core/MIPS/x86/X64IRCompSystem.cpp +++ b/Core/MIPS/x86/X64IRCompSystem.cpp @@ -147,7 +147,7 @@ void X64JitBackend::CompIR_Breakpoint(IRInst inst) { } bool isWrite = MIPSAnalyst::IsOpMemoryWrite(checkedPC); - const auto &memchecks = CBreakPoints::GetMemCheckRanges(isWrite); + const auto memchecks = CBreakPoints::GetMemCheckRanges(isWrite); // We can trivially skip if there are no checks for this type (i.e. read vs write.) if (memchecks.empty()) break; @@ -159,7 +159,6 @@ void X64JitBackend::CompIR_Breakpoint(IRInst inst) { FlushAll(); std::vector hitChecks; - hitChecks.reserve(memchecks.size()); for (const auto &it : memchecks) { if (it.end != 0) { CMP(32, R(SCRATCH1), Imm32(it.start - size)); @@ -396,7 +395,6 @@ void X64JitBackend::CompIR_ValidateAddress(IRInst inst) { AND(32, R(SCRATCH1), Imm32(0x3FFFFFFF)); std::vector validJumps; - validJumps.reserve(3); FixupBranch unaligned; if (alignment != 1) { diff --git a/Core/Util/GameDB.cpp b/Core/Util/GameDB.cpp index 7405f97de65a..538ca9205fdc 100644 --- a/Core/Util/GameDB.cpp +++ b/Core/Util/GameDB.cpp @@ -9,7 +9,6 @@ GameDB g_gameDB; static void SplitCSVLine(const std::string_view str, std::vector &result) { result.clear(); - result.reserve(str.size() + 1); int indexCommaToLeftOfColumn = 0; int indexCommaToRightOfColumn = -1; diff --git a/GPU/Common/DrawEngineCommon.cpp b/GPU/Common/DrawEngineCommon.cpp index e3c1e96eb5c9..83aaeb71640f 100644 --- a/GPU/Common/DrawEngineCommon.cpp +++ b/GPU/Common/DrawEngineCommon.cpp @@ -75,7 +75,6 @@ VertexDecoder *DrawEngineCommon::GetVertexDecoder(u32 vtype) { std::vector DrawEngineCommon::DebugGetVertexLoaderIDs() { std::vector ids; - ids.reserve(decoderMap_.size()); decoderMap_.Iterate([&](const uint32_t vtype, VertexDecoder *decoder) { std::string id; id.resize(sizeof(vtype)); diff --git a/GPU/Common/FragmentShaderGenerator.cpp b/GPU/Common/FragmentShaderGenerator.cpp index 67e73febf370..1bbdd19ace38 100644 --- a/GPU/Common/FragmentShaderGenerator.cpp +++ b/GPU/Common/FragmentShaderGenerator.cpp @@ -72,7 +72,6 @@ bool GenerateFragmentShader(const FShaderID &id, char *buffer, const ShaderLangu std::vector extensions; if (ShaderLanguageIsOpenGL(compat.shaderLanguage)) { - extensions.reserve(4); if (stencilToAlpha == REPLACE_ALPHA_DUALSOURCE && gl_extensions.EXT_blend_func_extended) { extensions.push_back("#extension GL_EXT_blend_func_extended : require"); } diff --git a/GPU/Common/GeometryShaderGenerator.cpp b/GPU/Common/GeometryShaderGenerator.cpp index 06229fc25df2..d09775cf7636 100644 --- a/GPU/Common/GeometryShaderGenerator.cpp +++ b/GPU/Common/GeometryShaderGenerator.cpp @@ -67,8 +67,6 @@ bool GenerateGeometryShader(const GShaderID &id, char *buffer, const ShaderLangu } std::vector varyings, outVaryings; - varyings.reserve(4); - outVaryings.reserve(4); if (id.Bit(GS_BIT_DO_TEXTURE)) { varyings.push_back(VaryingDef{ "vec3", "v_texcoord", Draw::SEM_TEXCOORD0, 0, "highp" }); diff --git a/GPU/D3D11/ShaderManagerD3D11.cpp b/GPU/D3D11/ShaderManagerD3D11.cpp index 462f65a92cbe..b6681aa8b4ef 100644 --- a/GPU/D3D11/ShaderManagerD3D11.cpp +++ b/GPU/D3D11/ShaderManagerD3D11.cpp @@ -251,7 +251,6 @@ std::vector ShaderManagerD3D11::DebugGetShaderIDs(DebugShaderType t switch (type) { case SHADER_TYPE_VERTEX: { - ids.reserve(vsCache_.size()); for (auto iter : vsCache_) { iter.first.ToString(&id); ids.push_back(id); @@ -260,7 +259,6 @@ std::vector ShaderManagerD3D11::DebugGetShaderIDs(DebugShaderType t } case SHADER_TYPE_FRAGMENT: { - ids.reserve(fsCache_.size()); for (auto iter : fsCache_) { iter.first.ToString(&id); ids.push_back(id); diff --git a/GPU/Directx9/ShaderManagerDX9.cpp b/GPU/Directx9/ShaderManagerDX9.cpp index 5f97efa3f9dc..790e6f760930 100644 --- a/GPU/Directx9/ShaderManagerDX9.cpp +++ b/GPU/Directx9/ShaderManagerDX9.cpp @@ -666,23 +666,17 @@ std::vector ShaderManagerDX9::DebugGetShaderIDs(DebugShaderType typ std::vector ids; switch (type) { case SHADER_TYPE_VERTEX: - { - ids.reserve(vsCache_.size()); for (auto iter : vsCache_) { iter.first.ToString(&id); ids.push_back(id); } - } - break; + break; case SHADER_TYPE_FRAGMENT: - { - ids.reserve(fsCache_.size()); for (auto iter : fsCache_) { iter.first.ToString(&id); ids.push_back(id); } - } - break; + break; } return ids; } diff --git a/GPU/GLES/DrawEngineGLES.cpp b/GPU/GLES/DrawEngineGLES.cpp index d96f8f7574fa..681f5e81bbbf 100644 --- a/GPU/GLES/DrawEngineGLES.cpp +++ b/GPU/GLES/DrawEngineGLES.cpp @@ -103,7 +103,6 @@ void DrawEngineGLES::InitDeviceObjects() { int stride = sizeof(TransformedVertex); std::vector entries; - entries.reserve(5); entries.push_back({ ATTR_POSITION, 4, GL_FLOAT, GL_FALSE, offsetof(TransformedVertex, x) }); entries.push_back({ ATTR_TEXCOORD, 3, GL_FLOAT, GL_FALSE, offsetof(TransformedVertex, u) }); entries.push_back({ ATTR_COLOR0, 4, GL_UNSIGNED_BYTE, GL_TRUE, offsetof(TransformedVertex, color0) }); diff --git a/GPU/GLES/ShaderManagerGLES.cpp b/GPU/GLES/ShaderManagerGLES.cpp index b6ce10489e88..9ac639601da9 100644 --- a/GPU/GLES/ShaderManagerGLES.cpp +++ b/GPU/GLES/ShaderManagerGLES.cpp @@ -914,24 +914,18 @@ std::vector ShaderManagerGLES::DebugGetShaderIDs(DebugShaderType ty std::vector ids; switch (type) { case SHADER_TYPE_VERTEX: - { - ids.reserve(vsCache_.size()); - vsCache_.Iterate([&](const VShaderID &id, Shader *shader) { - std::string idstr; - id.ToString(&idstr); - ids.push_back(idstr); - }); - } + vsCache_.Iterate([&](const VShaderID &id, Shader *shader) { + std::string idstr; + id.ToString(&idstr); + ids.push_back(idstr); + }); break; case SHADER_TYPE_FRAGMENT: - { - ids.reserve(fsCache_.size()); - fsCache_.Iterate([&](const FShaderID &id, Shader *shader) { - std::string idstr; - id.ToString(&idstr); - ids.push_back(idstr); - }); - } + fsCache_.Iterate([&](const FShaderID &id, Shader *shader) { + std::string idstr; + id.ToString(&idstr); + ids.push_back(idstr); + }); break; default: break; diff --git a/GPU/Vulkan/ShaderManagerVulkan.cpp b/GPU/Vulkan/ShaderManagerVulkan.cpp index 93777b5ed9c1..7b7412966b65 100644 --- a/GPU/Vulkan/ShaderManagerVulkan.cpp +++ b/GPU/Vulkan/ShaderManagerVulkan.cpp @@ -393,35 +393,26 @@ std::vector ShaderManagerVulkan::DebugGetShaderIDs(DebugShaderType std::vector ids; switch (type) { case SHADER_TYPE_VERTEX: - { - ids.reserve(vsCache_.size()); vsCache_.Iterate([&](const VShaderID &id, VulkanVertexShader *shader) { std::string idstr; id.ToString(&idstr); ids.push_back(idstr); }); break; - } case SHADER_TYPE_FRAGMENT: - { - ids.reserve(fsCache_.size()); fsCache_.Iterate([&](const FShaderID &id, VulkanFragmentShader *shader) { std::string idstr; id.ToString(&idstr); ids.push_back(idstr); }); break; - } case SHADER_TYPE_GEOMETRY: - { - ids.reserve(gsCache_.size()); gsCache_.Iterate([&](const GShaderID &id, VulkanGeometryShader *shader) { std::string idstr; id.ToString(&idstr); ids.push_back(idstr); }); break; - } default: break; } diff --git a/GPU/Vulkan/TextureCacheVulkan.cpp b/GPU/Vulkan/TextureCacheVulkan.cpp index 05217599e9b4..f6550eb3f016 100644 --- a/GPU/Vulkan/TextureCacheVulkan.cpp +++ b/GPU/Vulkan/TextureCacheVulkan.cpp @@ -187,7 +187,6 @@ void SamplerCache::DeviceRestore(VulkanContext *vulkan) { std::vector SamplerCache::DebugGetSamplerIDs() const { std::vector ids; - ids.reserve(cache_.size()); cache_.Iterate([&](const SamplerCacheKey &id, VkSampler sampler) { std::string idstr; id.ToString(&idstr); diff --git a/Windows/Debugger/CtrlMemView.cpp b/Windows/Debugger/CtrlMemView.cpp index 12e4f85d1c58..0efdeb468a89 100644 --- a/Windows/Debugger/CtrlMemView.cpp +++ b/Windows/Debugger/CtrlMemView.cpp @@ -850,7 +850,6 @@ std::vector CtrlMemView::searchString(const std::string &searchQuery) { return searchResAddrs; std::vector> memoryAreas; - memoryAreas.reserve(3); memoryAreas.emplace_back(PSP_GetScratchpadMemoryBase(), PSP_GetScratchpadMemoryEnd()); // Ignore the video memory mirrors. memoryAreas.emplace_back(PSP_GetVidMemBase(), 0x04200000); @@ -901,7 +900,6 @@ void CtrlMemView::search(bool continueSearch) { } std::vector> memoryAreas; - memoryAreas.reserve(3); // Ignore the video memory mirrors. memoryAreas.emplace_back(PSP_GetVidMemBase(), 0x04200000); memoryAreas.emplace_back(PSP_GetKernelMemoryBase(), PSP_GetUserMemoryEnd());