Moved null check before setting the status to "initializing". Otherwise, if the first call to InitFont() is with a null render scene, the status will get stuck in initializing forever and fonts will never render. This does NOT fix the text being drawn in the wrong location, that's a separate bug.

This commit is contained in:
mbalfour
2021-05-06 13:42:52 -05:00
parent 828284d109
commit 066a1eddf5
@@ -101,6 +101,11 @@ AZ::RPI::WindowContextSharedPtr AZ::FFont::GetDefaultWindowContext() const
bool AZ::FFont::InitFont(AZ::RPI::Scene* renderScene)
{
if (!renderScene)
{
return false;
}
auto initializationState = InitializationState::Uninitialized;
// Do an atomic transition to Initializing if we're in the Uninitialized state.
// Otherwise, check the current state.
@@ -111,11 +116,6 @@ bool AZ::FFont::InitFont(AZ::RPI::Scene* renderScene)
return initializationState == InitializationState::Initialized;
}
if (!renderScene)
{
return false;
}
// Create and initialize DynamicDrawContext for font draw
AZ::RPI::Ptr<AZ::RPI::DynamicDrawContext> dynamicDraw = m_atomFont->GetOrCreateDynamicDrawForScene(renderScene);