diff --git a/GPU/Common/PostShader.cpp b/GPU/Common/PostShader.cpp index 37066703e5..113aa662ac 100644 --- a/GPU/Common/PostShader.cpp +++ b/GPU/Common/PostShader.cpp @@ -225,7 +225,6 @@ void LoadPostShaderInfo(Draw::DrawContext *draw, const std::vector &direct off.settings[i].maxValue = 1.0f; off.settings[i].step = 0.01f; } - shaderInfo.insert(shaderInfo.begin(), off); TextureShaderInfo textureOff{}; textureOff.name = "Off"; @@ -233,6 +232,8 @@ void LoadPostShaderInfo(Draw::DrawContext *draw, const std::vector &direct textureShaderInfo.insert(textureShaderInfo.begin(), textureOff); // We always want the not visible ones at the end. Makes menus easier. + shaderInfo.reserve(notVisible.size() + 1); + shaderInfo.insert(shaderInfo.begin(), off); for (const auto &info : notVisible) { appendShader(info); } diff --git a/GPU/Common/ReplacedTexture.cpp b/GPU/Common/ReplacedTexture.cpp index 84fd0e2d93..b82aa88b4f 100644 --- a/GPU/Common/ReplacedTexture.cpp +++ b/GPU/Common/ReplacedTexture.cpp @@ -522,6 +522,7 @@ ReplacedTexture::LoadLevelResult ReplacedTexture::LoadLevelData(VFSFileReference basist::ktx2_transcoder_state transcodeState; // Each thread needs one of these. transcoder.start_transcoding(); + levels_.reserve(numMips); for (int i = 0; i < numMips; i++) { std::vector &out = data_[mipLevel + i]; @@ -574,6 +575,7 @@ ReplacedTexture::LoadLevelResult ReplacedTexture::LoadLevelData(VFSFileReference data_.resize(numMips); // A DDS File can contain multiple mipmaps. + levels_.reserve(numMips); for (int i = 0; i < numMips; i++) { std::vector &out = data_[mipLevel + i]; diff --git a/GPU/GLES/ShaderManagerGLES.cpp b/GPU/GLES/ShaderManagerGLES.cpp index 176b50aa85..052a99bfca 100644 --- a/GPU/GLES/ShaderManagerGLES.cpp +++ b/GPU/GLES/ShaderManagerGLES.cpp @@ -1141,6 +1141,7 @@ bool ShaderManagerGLES::LoadCache(File::IOFile &f) { } } + linkedShaderCache_.reserve(pending.link.size() - pending.linkPos); for (size_t &i = pending.linkPos; i < pending.link.size(); i++) { const VShaderID &vsid = pending.link[i].first; const FShaderID &fsid = pending.link[i].second; diff --git a/GPU/GPUCommon.cpp b/GPU/GPUCommon.cpp index e06b8390fd..2ee622d203 100644 --- a/GPU/GPUCommon.cpp +++ b/GPU/GPUCommon.cpp @@ -1606,6 +1606,7 @@ std::vector GPUCommon::DissassembleOpRange(u32 startpc, u32 endpc) { // Don't trigger a pause. u32 prev = Memory::IsValidAddress(startpc - 4) ? Memory::Read_U32(startpc - 4) : 0; + result.reserve((endpc - startpc) / 4); for (u32 pc = startpc; pc < endpc; pc += 4) { u32 op = Memory::IsValidAddress(pc) ? Memory::Read_U32(pc) : 0; GeDisassembleOp(pc, op, prev, buffer, sizeof(buffer));