disk_shader:update directory structure

This commit is contained in:
SachinVin 2021-03-30 23:18:34 +05:30
parent 8be0e81486
commit bb193da076
3 changed files with 11 additions and 7 deletions

View File

@ -534,7 +534,7 @@ bool ShaderDiskCache::EnsureDirectories() const {
return CreateDir(FileUtil::GetUserPath(FileUtil::UserPath::ShaderDir)) &&
CreateDir(GetBaseDir()) && CreateDir(GetTransferableDir()) &&
CreateDir(GetPrecompiledDir());
CreateDir(GetPrecompiledDir()) && CreateDir(GetPrecompiledShaderDir());
}
std::string ShaderDiskCache::GetTransferablePath() {
@ -542,7 +542,7 @@ std::string ShaderDiskCache::GetTransferablePath() {
}
std::string ShaderDiskCache::GetPrecompiledPath() {
return FileUtil::SanitizePath(GetPrecompiledDir() + DIR_SEP_CHR + GetTitleID() + ".bin");
return FileUtil::SanitizePath(GetPrecompiledShaderDir() + DIR_SEP_CHR + GetTitleID() + ".bin");
}
std::string ShaderDiskCache::GetTransferableDir() const {
@ -553,6 +553,13 @@ std::string ShaderDiskCache::GetPrecompiledDir() const {
return GetBaseDir() + DIR_SEP "precompiled";
}
std::string ShaderDiskCache::GetPrecompiledShaderDir() const {
if (separable) {
return GetPrecompiledDir() + DIR_SEP "separable";
}
return GetPrecompiledDir() + DIR_SEP "conventional";
}
std::string ShaderDiskCache::GetBaseDir() const {
return FileUtil::GetUserPath(FileUtil::UserPath::ShaderDir) + DIR_SEP "opengl";
}

View File

@ -162,6 +162,8 @@ private:
/// Get user's precompiled directory path
std::string GetPrecompiledDir() const;
std::string GetPrecompiledShaderDir() const;
/// Get user's shader directory path
std::string GetBaseDir() const;

View File

@ -482,11 +482,6 @@ void ShaderProgramManager::ApplyTo(OpenGLState& state) {
void ShaderProgramManager::LoadDiskCache(const std::atomic_bool& stop_loading,
const VideoCore::DiskResourceLoadCallback& callback) {
if (!impl->separable) {
LOG_ERROR(Render_OpenGL,
"Cannot load disk cache as separate shader programs are unsupported!");
// return;
}
auto& disk_cache = impl->disk_cache;
const auto transferable = disk_cache.LoadTransferable();
if (!transferable) {