gl_shader_disk_cache: Remove redundant code string construction in LoadDecompiledEntry()
We don't need to load the code into a vector and then construct a string over the data. We can just create a string with the necessary size ahead of time, and read the data directly into it, getting rid of an unnecessary heap allocation.
This commit is contained in:
parent
5e4c227608
commit
683c4e523f
1 changed files with 2 additions and 2 deletions
|
@ -287,13 +287,13 @@ std::optional<ShaderDiskCacheDecompiled> ShaderDiskCacheOpenGL::LoadDecompiledEn
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<u8> code(code_size);
|
std::string code(code_size, '\0');
|
||||||
if (!LoadArrayFromPrecompiled(code.data(), code.size())) {
|
if (!LoadArrayFromPrecompiled(code.data(), code.size())) {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
ShaderDiskCacheDecompiled entry;
|
ShaderDiskCacheDecompiled entry;
|
||||||
entry.code = std::string(reinterpret_cast<const char*>(code.data()), code_size);
|
entry.code = std::move(code);
|
||||||
|
|
||||||
u32 const_buffers_count{};
|
u32 const_buffers_count{};
|
||||||
if (!LoadObjectFromPrecompiled(const_buffers_count)) {
|
if (!LoadObjectFromPrecompiled(const_buffers_count)) {
|
||||||
|
|
Loading…
Reference in a new issue