rsx: Shaders cache loading and saving bugfixes

* Fixed crash whenever files are missing from the cache.
* Fixed crash whenever files are empty.
* Fixed crash whenever file creation/overwrite of cache files failed. (handled by fs::write_file)
* Fixed crash whenever there are any subdirectories inside the pipelines cache directories.
* Overwrite invalid shader cache files if encountered such.
* Optimizations have been added.
This commit is contained in:
Eladash 2021-01-02 07:20:11 +02:00 committed by kd-11
parent 2b8eb8deb6
commit 247e90b3d0
2 changed files with 59 additions and 35 deletions

View file

@ -733,9 +733,18 @@ namespace fs
// Always use write flag, remove read flag
if (fs::file f{path, mode + fs::write - fs::read})
{
// Write args sequentially
(f.write(args), ...);
return true;
if constexpr (sizeof...(args) == 2u && (std::is_pointer_v<Args> || ...))
{
// Specialization for [const void*, usz] args
f.write(args...);
return true;
}
else
{
// Write args sequentially
(f.write(args), ...);
return true;
}
}
return false;