Skip to content
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
6 changes: 3 additions & 3 deletions src/Features/UnifiedWater/WaterCache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ bool WaterCache::GenerateCaches()

const unsigned hw = std::max(1u, std::thread::hardware_concurrency());
const unsigned threads = std::max(1u, hw > 4 ? hw - 4 : (hw * 3) / 4);
async.pool = std::make_unique<BS::thread_pool>(threads);
async.pool = std::make_unique<BS::thread_pool<>>(threads);

async.failed.store(false);
buildProgress.Start(static_cast<uint32_t>(worldSpaces.size()));
Expand All @@ -232,7 +232,7 @@ bool WaterCache::GenerateCaches()
continue;
}

async.pool->push_task([this, worldSpace, editorID] {
async.pool->detach_task([this, worldSpace, editorID] {
DiskCache cache = {};
const auto name = std::format("{}_cache.wc", editorID);
const auto success = BuildDiskCache(worldSpace, cache) && TryWriteCacheToFile(name, cache.header, cache.instructions);
Expand All @@ -257,7 +257,7 @@ bool WaterCache::GenerateCaches()
}

if (async.pool)
async.pool->wait_for_tasks();
async.pool->wait();

buildProgress.Stop();
async.running.store(false);
Expand Down
2 changes: 1 addition & 1 deletion src/Features/UnifiedWater/WaterCache.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ class WaterCache

struct AsyncBuild
{
std::unique_ptr<BS::thread_pool> pool;
std::unique_ptr<BS::thread_pool<>> pool;
std::jthread monitor;
std::atomic<bool> running{ false };
std::atomic<bool> failed{ false };
Expand Down
6 changes: 3 additions & 3 deletions src/Features/VR/SettingsUI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,7 @@ namespace
char selectableId[64];
snprintf(selectableId, sizeof(selectableId), "##combo_row_%zu", row);
bool rowSelected = (row == static_cast<size_t>(selectedComboIndex));
if (ImGui::Selectable(selectableId, rowSelected, ImGuiSelectableFlags_SpanAllColumns | ImGuiSelectableFlags_AllowItemOverlap, ImVec2(0, 0))) {
if (ImGui::Selectable(selectableId, rowSelected, ImGuiSelectableFlags_SpanAllColumns | ImGuiSelectableFlags_AllowOverlap, ImVec2(0, 0))) {
selectedComboIndex = static_cast<int>(row);
}
ImGui::SameLine(0, 0);
Expand Down Expand Up @@ -1097,13 +1097,13 @@ void VR::DrawSettings()
}
}

if (ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_Enter)) || ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_KeypadEnter))) {
if (ImGui::IsKeyPressed(ImGuiKey_Enter) || ImGui::IsKeyPressed(ImGuiKey_KeypadEnter)) {
ApplyRecordedCombo();
ResetComboRecording();
ImGui::CloseCurrentPopup();
}

if (ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_Escape))) {
if (ImGui::IsKeyPressed(ImGuiKey_Escape)) {
ResetComboRecording();
ImGui::CloseCurrentPopup();
}
Expand Down
24 changes: 21 additions & 3 deletions src/Menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT(
LogSliderDeadzone,
TabRounding,
TabBorderSize,
TabMinWidthForCloseButton,
TabCloseButtonMinWidthUnselected,
TabBarBorderSize,
TableAngledHeadersAngle,
ColorButtonPosition,
Expand Down Expand Up @@ -183,6 +183,17 @@ static void SanitizeFontRolesJson(json& themeJson)
}
}

// Remove FullPalette from theme JSON if its size doesn't match ImGuiCol_COUNT.
// Prevents out_of_range exceptions when loading palettes saved with a different imgui version.
static void SanitizeFullPaletteJson(json& themeJson)
{
if (!themeJson.contains("FullPalette") || !themeJson["FullPalette"].is_array())
return;

if (themeJson["FullPalette"].size() != static_cast<size_t>(ImGuiCol_COUNT))
themeJson.erase("FullPalette");
}
Comment thread
alandtse marked this conversation as resolved.

std::optional<Menu::FontRole> Menu::ResolveFontRole(std::string_view key)
{
for (size_t i = 0; i < FontRoleDescriptors.size(); ++i) {
Expand Down Expand Up @@ -243,6 +254,8 @@ void Menu::Load(json& o_json)
// Store current Theme state before loading config
auto currentTheme = settings.Theme;

if (o_json.contains("Theme") && o_json["Theme"].is_object())
SanitizeFullPaletteJson(o_json["Theme"]);
settings = o_json;

// Restore Theme - don't load it from config, only from theme preset files
Expand Down Expand Up @@ -291,6 +304,7 @@ void Menu::Load(json& o_json)
if (o_json.contains("Theme") && o_json["Theme"].is_object() && settings.SelectedThemePreset.empty()) {
bool hasFontRoles = o_json["Theme"].contains("FontRoles");
SanitizeFontRolesJson(o_json["Theme"]);
SanitizeFullPaletteJson(o_json["Theme"]);
settings.Theme = o_json["Theme"];
MenuFonts::NormalizeFontRoles(settings.Theme, hasFontRoles);

Expand Down Expand Up @@ -356,6 +370,7 @@ void Menu::LoadTheme(json& o_json)
if (o_json["Theme"].is_object()) {
bool hasFontRoles = o_json["Theme"].contains("FontRoles");
SanitizeFontRolesJson(o_json["Theme"]);
SanitizeFullPaletteJson(o_json["Theme"]);
settings.Theme = o_json["Theme"];
MenuFonts::NormalizeFontRoles(settings.Theme, hasFontRoles);

Expand Down Expand Up @@ -414,6 +429,9 @@ bool Menu::LoadThemePreset(const std::string& themeName)
ThemeSettings defaultTheme; // For fallback values
bool hasFontRoles = themeSettings.contains("FontRoles");

SanitizeFontRolesJson(themeSettings);
SanitizeFullPaletteJson(themeSettings);

try {
// Attempt to load theme with protection against malformed data
try {
Expand Down Expand Up @@ -680,7 +698,7 @@ void Menu::DrawSettings()
// Apply theme styling with universal contrast enhancement
ThemeManager::SetupImGuiStyle(*this);

ImGui::DockSpaceOverViewport(NULL, ImGuiDockNodeFlags_PassthruCentralNode);
ImGui::DockSpaceOverViewport(0, NULL, ImGuiDockNodeFlags_PassthruCentralNode);

ImGui::SetNextWindowPos(Util::GetNativeViewportSizeScaled(0.5f), ImGuiCond_FirstUseEver, ImVec2(0.5f, 0.5f));
ImGui::SetNextWindowSize(Util::GetNativeViewportSizeScaled(0.8f), ImGuiCond_FirstUseEver);
Expand Down Expand Up @@ -870,7 +888,7 @@ void Menu::DrawOverlay()
{
// Only process reloads when ImGui is NOT in an active frame
ImGuiContext* ctx = ImGui::GetCurrentContext();
bool canReload = ctx && !ctx->WithinFrameScope && !ctx->WithinEndChild;
bool canReload = ctx && !ctx->WithinFrameScope && ctx->WithinEndChildID == 0;

// Process deferred font reload BEFORE any ImGui operations
// This is the safest place to do font atlas modifications
Expand Down
120 changes: 65 additions & 55 deletions src/Menu.h
Original file line number Diff line number Diff line change
Expand Up @@ -317,62 +317,72 @@ class Menu
}();
// Theme by @Maksasj, edited by FiveLimbedCat
// url: https://github.com/ocornut/imgui/issues/707#issuecomment-1494706165
// Entries ordered to match imgui 1.92+ ImGuiCol_ enum (62 entries).
// 7 new slots were inserted in the middle of the 1.90 enum; all subsequent
// indices shifted — corrected here to prevent colour mismatches.
std::array<ImVec4, ImGuiCol_COUNT> FullPalette = {
ImVec4(0.9f, 0.9f, 0.9f, 0.9f),
ImVec4(0.6f, 0.6f, 0.6f, 1.0f),
ImVec4(0.1f, 0.1f, 0.15f, 1.0f),
ImVec4(0.0f, 0.0f, 0.0f, 0.0f),
ImVec4(0.05f, 0.05f, 0.1f, 0.85f),
ImVec4(0.7f, 0.7f, 0.7f, 0.65f),
ImVec4(0.0f, 0.0f, 0.0f, 0.0f),
ImVec4(0.0f, 0.0f, 0.0f, 1.0f),
ImVec4(0.9f, 0.8f, 0.8f, 0.4f),
ImVec4(0.9f, 0.65f, 0.65f, 0.45f),
ImVec4(0.0f, 0.0f, 0.0f, 0.83f),
ImVec4(0.0f, 0.0f, 0.0f, 0.87f),
ImVec4(0.4f, 0.4f, 0.8f, 0.2f),
ImVec4(0.01f, 0.01f, 0.02f, 0.8f),
ImVec4(0.2f, 0.25f, 0.3f, 0.6f),
ImVec4(0.55f, 0.53f, 0.55f, 0.51f),
ImVec4(0.56f, 0.56f, 0.56f, 1.0f),
ImVec4(0.56f, 0.56f, 0.56f, 0.91f),
ImVec4(0.9f, 0.9f, 0.9f, 0.83f),
ImVec4(0.7f, 0.7f, 0.7f, 0.62f),
ImVec4(0.3f, 0.3f, 0.3f, 0.84f),
ImVec4(0.48f, 0.72f, 0.89f, 0.49f),
ImVec4(0.5f, 0.69f, 0.99f, 0.68f),
ImVec4(0.8f, 0.5f, 0.5f, 1.0f),
ImVec4(0.3f, 0.69f, 1.0f, 0.53f),
ImVec4(0.44f, 0.61f, 0.86f, 1.0f),
ImVec4(0.38f, 0.62f, 0.83f, 1.0f),
ImVec4(0.5f, 0.5f, 0.5f, 1.0f),
ImVec4(0.7f, 0.6f, 0.6f, 1.0f),
ImVec4(0.9f, 0.7f, 0.7f, 1.0f),
ImVec4(1.0f, 1.0f, 1.0f, 0.85f),
ImVec4(1.0f, 1.0f, 1.0f, 0.6f),
ImVec4(1.0f, 1.0f, 1.0f, 0.9f),
ImVec4(0.4f, 0.52f, 0.67f, 0.84f), // Tab
ImVec4(0.0f, 0.46f, 1.0f, 0.8f), // TabHovered
ImVec4(0.2f, 0.41f, 0.68f, 1.0f), // TabActive
ImVec4(0.07f, 0.1f, 0.15f, 0.97f), // TabUnfocused
ImVec4(0.13f, 0.26f, 0.42f, 1.0f), // TabUnfocusedActive
ImVec4(0.7f, 0.6f, 0.6f, 0.5f), // DockingPreview
ImVec4(0.0f, 0.0f, 0.0f, 0.0f), // DockingEmptyBg
ImVec4(1.0f, 1.0f, 1.0f, 1.0f), // PlotLines
ImVec4(0.0f, 0.87f, 1.0f, 1.0f),
ImVec4(0.22f, 0.26f, 0.7f, 1.0f),
ImVec4(0.8f, 0.26f, 0.26f, 1.0f),
ImVec4(0.48f, 0.72f, 0.89f, 0.49f),
ImVec4(0.3f, 0.3f, 0.35f, 1.0f),
ImVec4(0.23f, 0.23f, 0.25f, 1.0f),
ImVec4(0.0f, 0.0f, 0.0f, 0.0f),
ImVec4(1.0f, 1.0f, 1.0f, 0.06f),
ImVec4(0.0f, 0.0f, 1.0f, 0.35f), // TextSelectedBg
ImVec4(0.8f, 0.5f, 0.5f, 1.0f),
ImVec4(0.44f, 0.61f, 0.86f, 1.0f),
ImVec4(0.3f, 0.3f, 0.3f, 0.56f),
ImVec4(0.2f, 0.2f, 0.2f, 0.35f),
ImVec4(0.2f, 0.2f, 0.2f, 0.35f),
ImVec4(0.9f, 0.9f, 0.9f, 0.9f), // [0] Text
ImVec4(0.6f, 0.6f, 0.6f, 1.0f), // [1] TextDisabled
ImVec4(0.1f, 0.1f, 0.15f, 1.0f), // [2] WindowBg
ImVec4(0.0f, 0.0f, 0.0f, 0.0f), // [3] ChildBg
ImVec4(0.05f, 0.05f, 0.1f, 0.85f), // [4] PopupBg
ImVec4(0.7f, 0.7f, 0.7f, 0.65f), // [5] Border
ImVec4(0.0f, 0.0f, 0.0f, 0.0f), // [6] BorderShadow
ImVec4(0.0f, 0.0f, 0.0f, 1.0f), // [7] FrameBg
ImVec4(0.9f, 0.8f, 0.8f, 0.4f), // [8] FrameBgHovered
ImVec4(0.9f, 0.65f, 0.65f, 0.45f), // [9] FrameBgActive
ImVec4(0.0f, 0.0f, 0.0f, 0.83f), // [10] TitleBg
ImVec4(0.0f, 0.0f, 0.0f, 0.87f), // [11] TitleBgActive
ImVec4(0.4f, 0.4f, 0.8f, 0.2f), // [12] TitleBgCollapsed
ImVec4(0.01f, 0.01f, 0.02f, 0.8f), // [13] MenuBarBg
ImVec4(0.2f, 0.25f, 0.3f, 0.6f), // [14] ScrollbarBg
ImVec4(0.55f, 0.53f, 0.55f, 0.51f), // [15] ScrollbarGrab
ImVec4(0.56f, 0.56f, 0.56f, 1.0f), // [16] ScrollbarGrabHovered
ImVec4(0.56f, 0.56f, 0.56f, 0.91f), // [17] ScrollbarGrabActive
ImVec4(0.9f, 0.9f, 0.9f, 0.83f), // [18] CheckMark
ImVec4(0.7f, 0.7f, 0.7f, 0.62f), // [19] SliderGrab
ImVec4(0.3f, 0.3f, 0.3f, 0.84f), // [20] SliderGrabActive
ImVec4(0.48f, 0.72f, 0.89f, 0.49f), // [21] Button
ImVec4(0.5f, 0.69f, 0.99f, 0.68f), // [22] ButtonHovered
ImVec4(0.8f, 0.5f, 0.5f, 1.0f), // [23] ButtonActive
ImVec4(0.3f, 0.69f, 1.0f, 0.53f), // [24] Header
ImVec4(0.44f, 0.61f, 0.86f, 1.0f), // [25] HeaderHovered
ImVec4(0.38f, 0.62f, 0.83f, 1.0f), // [26] HeaderActive
ImVec4(0.5f, 0.5f, 0.5f, 1.0f), // [27] Separator
ImVec4(0.7f, 0.6f, 0.6f, 1.0f), // [28] SeparatorHovered
ImVec4(0.9f, 0.7f, 0.7f, 1.0f), // [29] SeparatorActive
ImVec4(1.0f, 1.0f, 1.0f, 0.85f), // [30] ResizeGrip
ImVec4(1.0f, 1.0f, 1.0f, 0.6f), // [31] ResizeGripHovered
ImVec4(1.0f, 1.0f, 1.0f, 0.9f), // [32] ResizeGripActive
ImVec4(0.9f, 0.9f, 0.9f, 1.0f), // [33] InputTextCursor (new in 1.92)
ImVec4(0.0f, 0.46f, 1.0f, 0.8f), // [34] TabHovered
ImVec4(0.4f, 0.52f, 0.67f, 0.84f), // [35] Tab
ImVec4(0.2f, 0.41f, 0.68f, 1.0f), // [36] TabSelected
ImVec4(0.38f, 0.62f, 0.83f, 1.0f), // [37] TabSelectedOverline (new in 1.91)
ImVec4(0.07f, 0.1f, 0.15f, 0.97f), // [38] TabDimmed
ImVec4(0.13f, 0.26f, 0.42f, 1.0f), // [39] TabDimmedSelected
ImVec4(0.5f, 0.5f, 0.5f, 0.0f), // [40] TabDimmedSelectedOverline (new in 1.91)
ImVec4(0.7f, 0.6f, 0.6f, 0.5f), // [41] DockingPreview
ImVec4(0.0f, 0.0f, 0.0f, 0.0f), // [42] DockingEmptyBg
ImVec4(1.0f, 1.0f, 1.0f, 1.0f), // [43] PlotLines
ImVec4(0.0f, 0.87f, 1.0f, 1.0f), // [44] PlotLinesHovered
ImVec4(0.22f, 0.26f, 0.7f, 1.0f), // [45] PlotHistogram
ImVec4(0.8f, 0.26f, 0.26f, 1.0f), // [46] PlotHistogramHovered
ImVec4(0.48f, 0.72f, 0.89f, 0.49f), // [47] TableHeaderBg
ImVec4(0.3f, 0.3f, 0.35f, 1.0f), // [48] TableBorderStrong
ImVec4(0.23f, 0.23f, 0.25f, 1.0f), // [49] TableBorderLight
ImVec4(0.0f, 0.0f, 0.0f, 0.0f), // [50] TableRowBg (transparent)
ImVec4(1.0f, 1.0f, 1.0f, 0.06f), // [51] TableRowBgAlt (subtle tint)
ImVec4(0.38f, 0.62f, 0.83f, 1.0f), // [52] TextLink (new in 1.92)
ImVec4(0.0f, 0.0f, 1.0f, 0.35f), // [53] TextSelectedBg
ImVec4(0.7f, 0.7f, 0.7f, 0.65f), // [54] TreeLines (new in 1.92)
ImVec4(0.8f, 0.5f, 0.5f, 1.0f), // [55] DragDropTarget
ImVec4(0.0f, 0.0f, 0.0f, 0.0f), // [56] DragDropTargetBg (new in 1.92)
ImVec4(1.0f, 1.0f, 1.0f, 1.0f), // [57] UnsavedMarker (new in 1.92)
ImVec4(0.44f, 0.61f, 0.86f, 1.0f), // [58] NavCursor
ImVec4(0.3f, 0.3f, 0.3f, 0.56f), // [59] NavWindowingHighlight
ImVec4(0.2f, 0.2f, 0.2f, 0.35f), // [60] NavWindowingDimBg
ImVec4(0.2f, 0.2f, 0.2f, 0.35f), // [61] ModalWindowDimBg
};
};

Expand Down
4 changes: 2 additions & 2 deletions src/Menu/AdvancedSettingsRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ void AdvancedSettingsRenderer::RenderLoggingSection()
globals::state->SetDefines(shaderDefines);
}
if (ImGui::IsItemDeactivatedAfterEdit() || (ImGui::IsItemActive() &&
(ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_Enter)) ||
ImGui::IsKeyPressed(ImGui::GetKeyIndex(ImGuiKey_KeypadEnter))))) {
(ImGui::IsKeyPressed(ImGuiKey_Enter) ||
ImGui::IsKeyPressed(ImGuiKey_KeypadEnter)))) {
globals::state->SetDefines(shaderDefines);
shaderCache->Clear();
}
Expand Down
4 changes: 2 additions & 2 deletions src/Menu/Fonts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ namespace MenuFonts
if (menuInstance) {
font_ = menuInstance->GetFont(role);
if (font_) {
ImGui::PushFont(font_);
ImGui::PushFont(font_, 0.0f);
}
}
}
Expand All @@ -148,7 +148,7 @@ namespace MenuFonts
ImFont* bodyFont = globals::menu->GetFont(FontRole::Body);

if (tabFont && bodyFont) {
float fontScale = tabFont->FontSize / bodyFont->FontSize;
float fontScale = tabFont->LegacySize / bodyFont->LegacySize;

// Only scale if the tab font is noticeably larger
if (fontScale > 1.05f) {
Expand Down
2 changes: 1 addition & 1 deletion src/Menu/HomePageRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ void HomePageRenderer::RenderWelcomeSection()

// Only push font if we have a valid one, otherwise use default scaled
if (titleFont) {
ImGui::PushFont(titleFont);
ImGui::PushFont(titleFont, 0.0f);
}

ImVec2 windowSize = ImGui::GetWindowSize();
Expand Down
2 changes: 1 addition & 1 deletion src/Menu/MenuHeaderRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ namespace

font_ = menuInstance->GetFont(role);
if (font_) {
ImGui::PushFont(font_);
ImGui::PushFont(font_, 0.0f);
fontPushed_ = true;
} else {
logger::warn("RoleFontGuard: Failed to retrieve font for role {}", static_cast<int>(role));
Expand Down
3 changes: 1 addition & 2 deletions src/Menu/SettingsTabRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -948,8 +948,7 @@ void SettingsTabRenderer::RenderStylingTab()
if (ImGui::SliderFloat("Global Scale", &themeSettings.GlobalScale, -1.f, 1.f, "%.2f")) {
float trueScale = exp2(themeSettings.GlobalScale);

auto& io = ImGui::GetIO();
io.FontGlobalScale = trueScale;
ImGui::GetStyle().FontScaleMain = trueScale;
}

SeparatorTextWithFont("Layout", Menu::FontRole::Subheading);
Expand Down
6 changes: 3 additions & 3 deletions src/Menu/ThemeManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ void ThemeManager::SetupImGuiStyle(const Menu& menu)
auto& io = ImGui::GetIO();
if (io.FontDefault) {
constexpr float kBaselineFontSize = Constants::DEFAULT_SCREEN_HEIGHT * Constants::DEFAULT_FONT_RATIO;
fontScale = io.FontDefault->FontSize / kBaselineFontSize;
fontScale = io.FontDefault->LegacySize / kBaselineFontSize;
}
const float scaleFactor = fontScale * exp2(globalScale);
styleCopy.ScaleAllSizes(scaleFactor);
Expand Down Expand Up @@ -449,7 +449,7 @@ bool ThemeManager::ReloadFont(const Menu& menu, float& cachedFontSize)
}

// Verify font texture was created successfully
if (!io.Fonts->TexID) {
if (!io.Fonts->TexIsBuilt) {
logger::error("ReloadFont: Font texture not created");
return false;
}
Expand All @@ -461,7 +461,7 @@ bool ThemeManager::ReloadFont(const Menu& menu, float& cachedFontSize)
globalScale = Constants::DEFAULT_GLOBAL_SCALE; // Ensure built-in themes stay at 0.0
}

io.FontGlobalScale = exp2(globalScale);
ImGui::GetStyle().FontScaleMain = exp2(globalScale);

cachedFontSize = fontSize;
// Also update cached font name in the menu instance
Expand Down
8 changes: 4 additions & 4 deletions src/ShaderCache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1926,7 +1926,7 @@ namespace SIE
{
Clear();
StopFileWatcher();
if (!compilationPool.wait_for_tasks_duration(std::chrono::milliseconds(1000))) {
if (!compilationPool.wait_for(std::chrono::milliseconds(1000))) {
logger::info("Tasks still running despite request to stop; killing thread {}!", GetThreadId(managementThread));
WaitForSingleObject(managementThread, 1000);
TerminateThread(managementThread, 0);
Expand Down Expand Up @@ -2312,7 +2312,7 @@ namespace SIE
{
dependencyTracker = std::make_unique<ShaderFileDependencyTracker>();
logger::debug("ShaderCache initialized with {} compiler threads", (int)compilationThreadCount);
compilationPool.push_task(&ShaderCache::ManageCompilationSet, this, ssource.get_token());
compilationPool.detach_task([this, token = ssource.get_token()] { ManageCompilationSet(token); });
}

bool ShaderCache::UseFileWatcher() const
Expand Down Expand Up @@ -2346,7 +2346,7 @@ namespace SIE
pathStr += std::format("{}; ", path);
}
logger::debug("ShaderCache watching for changes in {}", pathStr);
compilationPool.push_task(&SIE::UpdateListener::processQueue, listener);
compilationPool.detach_task([this] { listener->processQueue(); });
} else {
logger::debug("ShaderCache already enabled");
}
Expand Down Expand Up @@ -2720,7 +2720,7 @@ namespace SIE
const auto& task = compilationSet.WaitTake(stoken);
if (!task.has_value())
break; // exit because thread told to end
compilationPool.push_task(&ShaderCache::ProcessCompilationSet, this, stoken, task.value());
compilationPool.detach_task([this, stoken, t = task.value()] { ProcessCompilationSet(stoken, t); });
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/ShaderCache.h
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ namespace SIE

int32_t compilationThreadCount = std::max({ static_cast<int32_t>(std::thread::hardware_concurrency()) - 4, static_cast<int32_t>(std::thread::hardware_concurrency()) * 3 / 4, 1 });
int32_t backgroundCompilationThreadCount = std::max(static_cast<int32_t>(std::thread::hardware_concurrency()) / 2, 1);
BS::thread_pool compilationPool{};
BS::thread_pool<> compilationPool{};
bool backgroundCompilation = false;
bool menuLoaded = false;

Expand Down
Loading
Loading