Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: unify shadercache clearing #691

Merged
merged 1 commit into from
Oct 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 1 addition & 12 deletions src/Menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -276,12 +276,7 @@ void Menu::DrawSettings()
ImGui::TableNextColumn();
if (ImGui::Button("Clear Shader Cache", { -1, 0 })) {
shaderCache.Clear();
Deferred::GetSingleton()->ClearShaderCache();
for (auto* feature : Feature::GetFeatureList()) {
if (feature->loaded) {
feature->ClearShaderCache();
}
}
// any features should be added to shadercache's clear.
}
if (auto _tt = Util::HoverTooltipWrapper()) {
ImGui::Text(
Expand Down Expand Up @@ -772,12 +767,6 @@ void Menu::DrawAdvancedSettings()
ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_KeypadEnter))))) {
State::GetSingleton()->SetDefines(shaderDefines);
shaderCache.Clear();
Deferred::GetSingleton()->ClearShaderCache();
for (auto* feature : Feature::GetFeatureList()) {
if (feature->loaded) {
feature->ClearShaderCache();
}
}
}
if (auto _tt = Util::HoverTooltipWrapper()) {
ImGui::Text("Defines for Shader Compiler. Semicolon \";\" separated. Clear with space. Rebuild shaders after making change. Compute Shaders require a restart to recompile.");
Expand Down
6 changes: 6 additions & 0 deletions src/ShaderCache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1854,6 +1854,12 @@ namespace SIE
hlslToShaderMap.clear();
}
compilationSet.Clear();
Deferred::GetSingleton()->ClearShaderCache();
for (auto* feature : Feature::GetFeatureList()) {
if (feature->loaded) {
feature->ClearShaderCache();
}
}
}

template <typename ShaderType, typename MutexType>
Expand Down
Loading