mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 10:17:22 +01:00
Wrap font texture upload in try/catch and log/retry in 4k x 4k on exception (#843)
This commit is contained in:
parent
a241e646b6
commit
0971100696
2 changed files with 33 additions and 2 deletions
|
|
@ -1012,7 +1012,36 @@ namespace Dalamud.Interface.Internal
|
|||
|
||||
Log.Verbose("[FONT] RebuildFontsInternal() detaching");
|
||||
this.scene.OnNewRenderFrame -= this.RebuildFontsInternal;
|
||||
this.scene.InvalidateFonts();
|
||||
|
||||
Log.Verbose("[FONT] Calling InvalidateFonts");
|
||||
try
|
||||
{
|
||||
this.scene.InvalidateFonts();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if (this.FontResolutionLevel > 2)
|
||||
{
|
||||
Log.Error(ex, "[FONT] Failed to create font textures; setting font resolution level to 2 and retrying");
|
||||
this.FontResolutionLevelOverride = 2;
|
||||
this.SetupFonts();
|
||||
}
|
||||
else
|
||||
{
|
||||
Log.Error(ex, "[FONT] Failed to create font textures; forcing fallback font mode");
|
||||
this.SetupFonts(true);
|
||||
}
|
||||
|
||||
Log.Verbose("[FONT] Calling InvalidateFonts again");
|
||||
try
|
||||
{
|
||||
this.scene.InvalidateFonts();
|
||||
}
|
||||
catch (Exception ex2)
|
||||
{
|
||||
Log.Error(ex2, "[FONT] Giving up");
|
||||
}
|
||||
}
|
||||
|
||||
Log.Verbose("[FONT] Font Rebuild OK!");
|
||||
|
||||
|
|
|
|||
|
|
@ -367,6 +367,8 @@ namespace Dalamud.Interface.Internal.Windows
|
|||
ImGuiHelpers.ScaledDummy(3);
|
||||
|
||||
ImGui.Text(Loc.Localize("DalamudSettingsFontResolutionLevel", "Font resolution level"));
|
||||
if (interfaceManager.FontResolutionLevelOverride != null)
|
||||
this.fontResolutionLevel = interfaceManager.FontResolutionLevelOverride.Value;
|
||||
if (ImGui.Combo("##DalamudSettingsFontResolutionLevelCombo", ref this.fontResolutionLevel, this.fontResolutionLevelStrings, this.fontResolutionLevelStrings.Length))
|
||||
{
|
||||
interfaceManager.FontResolutionLevelOverride = this.fontResolutionLevel;
|
||||
|
|
@ -377,7 +379,7 @@ namespace Dalamud.Interface.Internal.Windows
|
|||
ImGui.TextWrapped(string.Format(
|
||||
Loc.Localize(
|
||||
"DalamudSettingsFontResolutionLevelHint",
|
||||
"This option allows Dalamud fonts to look better.\n* If your game crashes right away when changing this option, your PC does not support high font resolutions in Dalamud - you will have to use a lower one.\n* If it doesn't crash immediately, then you can keep the new choice indefinitely as it's not going to crash your game once it worked.\n* Either choose the 3rd or 5th option. Use other options only when neither works well.\n* Current font atlas size is {0}px * {1}px."),
|
||||
"This option allows Dalamud fonts to look better.\n* If your game crashes right away, or the option reverts, when changing this option, your PC does not support high font resolutions in Dalamud - you will have to use a lower one.\n* If it doesn't crash or revert immediately, then you can keep the new choice indefinitely as it's not going to crash your game once it worked.\n* Either choose the 3rd or 5th option. Use other options only when neither works well.\n* Current font atlas size is {0}px * {1}px."),
|
||||
ImGui.GetIO().Fonts.TexWidth,
|
||||
ImGui.GetIO().Fonts.TexHeight));
|
||||
ImGui.PopStyleColor();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue