separate metal shader cache

This commit is contained in:
Samuliak 2024-11-04 19:03:59 +01:00
parent 2e93b08b39
commit 27902009c6
No known key found for this signature in database
3 changed files with 20 additions and 10 deletions

View File

@ -257,7 +257,11 @@ void LatteShaderCache_Load()
#endif #endif
// get cache file name // get cache file name
const auto pathGeneric = ActiveSettings::GetCachePath("shaderCache/transferable/{:016x}_shaders.bin", cacheTitleId); fs::path pathGeneric;
if (g_renderer->GetType() == RendererAPI::Metal)
pathGeneric = ActiveSettings::GetCachePath("shaderCache/transferable/{:016x}_mtlshaders.bin", cacheTitleId);
else
pathGeneric = ActiveSettings::GetCachePath("shaderCache/transferable/{:016x}_shaders.bin", cacheTitleId);
const auto pathGenericPre1_25_0 = ActiveSettings::GetCachePath("shaderCache/transferable/{:016x}.bin", cacheTitleId); // before 1.25.0 const auto pathGenericPre1_25_0 = ActiveSettings::GetCachePath("shaderCache/transferable/{:016x}.bin", cacheTitleId); // before 1.25.0
const auto pathGenericPre1_16_0 = ActiveSettings::GetCachePath("shaderCache/transferable/{:08x}.bin", CafeSystem::GetRPXHashBase()); // before 1.16.0 const auto pathGenericPre1_16_0 = ActiveSettings::GetCachePath("shaderCache/transferable/{:08x}.bin", CafeSystem::GetRPXHashBase()); // before 1.16.0

View File

@ -70,7 +70,9 @@ std::list<fs::path> _getCachesPaths(const TitleId& titleId)
ActiveSettings::GetCachePath(L"shaderCache/precompiled/{:016x}_spirv.bin", titleId), ActiveSettings::GetCachePath(L"shaderCache/precompiled/{:016x}_spirv.bin", titleId),
ActiveSettings::GetCachePath(L"shaderCache/precompiled/{:016x}_gl.bin", titleId), ActiveSettings::GetCachePath(L"shaderCache/precompiled/{:016x}_gl.bin", titleId),
ActiveSettings::GetCachePath(L"shaderCache/transferable/{:016x}_shaders.bin", titleId), ActiveSettings::GetCachePath(L"shaderCache/transferable/{:016x}_shaders.bin", titleId),
ActiveSettings::GetCachePath(L"shaderCache/transferable/{:016x}_vkpipeline.bin", titleId)}; ActiveSettings::GetCachePath(L"shaderCache/transferable/{:016x}_mtlshaders.bin", titleId),
ActiveSettings::GetCachePath(L"shaderCache/transferable/{:016x}_vkpipeline.bin", titleId),
ActiveSettings::GetCachePath(L"shaderCache/transferable/{:016x}_mtlpipeline.bin", titleId)};
cachePaths.remove_if( cachePaths.remove_if(
[](const fs::path& cachePath) [](const fs::path& cachePath)
@ -200,13 +202,13 @@ void wxGameList::OnGameListSize(wxSizeEvent &event)
for(int i = GetColumnCount() - 1; i > 0; i--) for(int i = GetColumnCount() - 1; i > 0; i--)
{ {
#ifdef wxHAS_LISTCTRL_COLUMN_ORDER #ifdef wxHAS_LISTCTRL_COLUMN_ORDER
if(GetColumnWidth(GetColumnIndexFromOrder(i)) > 0) if(GetColumnWidth(GetColumnIndexFromOrder(i)) > 0)
{ {
last_col_index = GetColumnIndexFromOrder(i); last_col_index = GetColumnIndexFromOrder(i);
break; break;
} }
#else #else
if(GetColumnWidth(i) > 0) if(GetColumnWidth(i) > 0)
{ {
last_col_index = i; last_col_index = i;
break; break;
@ -938,13 +940,13 @@ void wxGameList::OnColumnBeginResize(wxListEvent& event)
for(int i = GetColumnCount() - 1; i > 0; i--) for(int i = GetColumnCount() - 1; i > 0; i--)
{ {
#ifdef wxHAS_LISTCTRL_COLUMN_ORDER #ifdef wxHAS_LISTCTRL_COLUMN_ORDER
if(GetColumnWidth(GetColumnIndexFromOrder(i)) > 0) if(GetColumnWidth(GetColumnIndexFromOrder(i)) > 0)
{ {
last_col_index = GetColumnIndexFromOrder(i); last_col_index = GetColumnIndexFromOrder(i);
break; break;
} }
#else #else
if(GetColumnWidth(i) > 0) if(GetColumnWidth(i) > 0)
{ {
last_col_index = i; last_col_index = i;
break; break;
@ -1076,7 +1078,7 @@ void wxGameList::OnGameEntryUpdatedByTitleId(wxTitleIdEvent& event)
wxString minutesText = formatWxString(wxPLURAL("{} minute", "{} minutes", minutes), minutes); wxString minutesText = formatWxString(wxPLURAL("{} minute", "{} minutes", minutes), minutes);
SetItem(index, ColumnGameTime, hoursText + " " + minutesText); SetItem(index, ColumnGameTime, hoursText + " " + minutesText);
} }
// last played // last played
if (playTimeStat.last_played.year != 0) if (playTimeStat.last_played.year != 0)
{ {
@ -1290,7 +1292,7 @@ bool wxGameList::QueryIconForTitle(TitleId titleId, int& icon, int& iconSmall)
return true; return true;
} }
void wxGameList::DeleteCachedStrings() void wxGameList::DeleteCachedStrings()
{ {
m_name_cache.clear(); m_name_cache.clear();
} }
@ -1448,7 +1450,7 @@ void wxGameList::CreateShortcut(GameInfo2& gameInfo)
if (SUCCEEDED(hres)) if (SUCCEEDED(hres))
{ {
hres = shellLinkFile->Save(outputPath.wc_str(), TRUE); hres = shellLinkFile->Save(outputPath.wc_str(), TRUE);
shellLinkFile->Release(); shellLinkFile->Release();
} }
shellLink->Release(); shellLink->Release();
} }
@ -1457,4 +1459,4 @@ void wxGameList::CreateShortcut(GameInfo2& gameInfo)
wxMessageBox(errorMsg, _("Error"), wxOK | wxCENTRE | wxICON_ERROR); wxMessageBox(errorMsg, _("Error"), wxOK | wxCENTRE | wxICON_ERROR);
} }
} }
#endif #endif

View File

@ -106,6 +106,8 @@ void MergeShaderAndPipelineCacheFiles()
auto filename = it.path().filename().generic_string(); auto filename = it.path().filename().generic_string();
if (std::regex_match(filename, std::regex("^[0-9a-fA-F]{16}(?:_shaders.bin)"))) if (std::regex_match(filename, std::regex("^[0-9a-fA-F]{16}(?:_shaders.bin)")))
MergeShaderCacheFile(filename); MergeShaderCacheFile(filename);
if (std::regex_match(filename, std::regex("^[0-9a-fA-F]{16}(?:_mtlshaders.bin)")))
MergeShaderCacheFile(filename);
} }
printf("\nScanning for pipeline cache files to merge...\n"); printf("\nScanning for pipeline cache files to merge...\n");
for (const auto& it : fs::directory_iterator("shaderCache/transferable/")) for (const auto& it : fs::directory_iterator("shaderCache/transferable/"))
@ -115,6 +117,8 @@ void MergeShaderAndPipelineCacheFiles()
auto filename = it.path().filename().generic_string(); auto filename = it.path().filename().generic_string();
if (std::regex_match(filename, std::regex("^[0-9a-fA-F]{16}(?:_vkpipeline.bin)"))) if (std::regex_match(filename, std::regex("^[0-9a-fA-F]{16}(?:_vkpipeline.bin)")))
MergePipelineCacheFile(filename); MergePipelineCacheFile(filename);
if (std::regex_match(filename, std::regex("^[0-9a-fA-F]{16}(?:_mtlpipeline.bin)")))
MergePipelineCacheFile(filename);
} }
} }