NoGUI: Fail startup if font atlas creation fails

This commit is contained in:
Connor McLaughlin 2021-04-10 14:59:59 +10:00
parent 6a0bd7ee64
commit 3c83ef4939
2 changed files with 8 additions and 8 deletions

View file

@ -114,7 +114,8 @@ bool NoGUIHostInterface::CreateDisplay()
if (!m_display->CreateRenderDevice(wi.value(), g_settings.gpu_adapter, g_settings.gpu_use_debug_device,
g_settings.gpu_threaded_presentation) ||
!m_display->InitializeRenderDevice(GetShaderCacheBasePath(), g_settings.gpu_use_debug_device,
g_settings.gpu_threaded_presentation))
g_settings.gpu_threaded_presentation) ||
!CreateHostDisplayResources())
{
m_display->DestroyRenderDevice();
m_display.reset();
@ -125,7 +126,8 @@ bool NoGUIHostInterface::CreateDisplay()
if (!CreateHostDisplayResources())
Log_WarningPrint("Failed to create host display resources");
Log_InfoPrintf("Host display initialized at %ux%u resolution", m_display->GetWindowWidth(), m_display->GetWindowHeight());
Log_InfoPrintf("Host display initialized at %ux%u resolution", m_display->GetWindowWidth(),
m_display->GetWindowHeight());
return true;
}

View file

@ -517,11 +517,6 @@ void CommonHostInterface::CreateImGuiContext()
bool CommonHostInterface::CreateHostDisplayResources()
{
m_logo_texture = m_display->CreateTexture(APP_ICON_WIDTH, APP_ICON_HEIGHT, 1, 1, 1, HostDisplayPixelFormat::RGBA8,
APP_ICON_DATA, sizeof(u32) * APP_ICON_WIDTH, false);
if (!m_logo_texture)
Log_WarningPrintf("Failed to create logo texture");
const float framebuffer_scale = m_display->GetWindowScale();
ImGui::GetIO().DisplayFramebufferScale = ImVec2(framebuffer_scale, framebuffer_scale);
ImGui::GetIO().DisplaySize.x = static_cast<float>(m_display->GetWindowWidth());
@ -548,13 +543,16 @@ bool CommonHostInterface::CreateHostDisplayResources()
if (!m_fullscreen_ui_enabled)
ImGuiFullscreen::ResetFonts();
if (!m_display->UpdateImGuiFontTexture())
m_logo_texture = m_display->CreateTexture(APP_ICON_WIDTH, APP_ICON_HEIGHT, 1, 1, 1, HostDisplayPixelFormat::RGBA8,
APP_ICON_DATA, sizeof(u32) * APP_ICON_WIDTH, false);
if (!m_logo_texture || !m_display->UpdateImGuiFontTexture())
{
Log_ErrorPrintf("Failed to create ImGui font text");
if (m_fullscreen_ui_enabled)
FullscreenUI::Shutdown();
m_display->DestroyImGuiContext();
m_logo_texture.reset();
return false;
}