Crash fixes in LyShine with pRenderer being nullptr now (#496)

This commit is contained in:
Terry Michaels
2021-04-30 19:41:46 -05:00
committed by GitHub
parent 7a2f698bbc
commit 3eed53fa27
3 changed files with 2 additions and 11 deletions
@@ -764,9 +764,6 @@ void UiParticleEmitterComponent::InGamePostActivate()
////////////////////////////////////////////////////////////////////////////////////////////////////
void UiParticleEmitterComponent::Render(LyShine::IRenderGraph* renderGraph)
{
const char* profileMarker = "UI_PARTICLESYS";
gEnv->pRenderer->PushProfileMarker(profileMarker);
AZ::Matrix4x4 transform = AZ::Matrix4x4::CreateIdentity();
AZ::Vector2 emitterOffset = AZ::Vector2::CreateZero();
@@ -840,8 +837,6 @@ void UiParticleEmitterComponent::Render(LyShine::IRenderGraph* renderGraph)
m_cachedPrimitive.m_numVertices = totalVerticesInserted;
m_cachedPrimitive.m_numIndices = totalParticlesInserted * indicesPerParticle;
renderGraph->AddPrimitive(&m_cachedPrimitive, texture, isClampTextureMode, isTextureSRGB, isTexturePremultipliedAlpha, m_blendMode);
gEnv->pRenderer->PopProfileMarker(profileMarker);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -1911,9 +1911,6 @@ void UiTextComponent::Render(LyShine::IRenderGraph* renderGraph)
for (RenderCacheBatch* batch : m_renderCache.m_batches)
{
const char* profileMarker = "UI_TEXT";
gEnv->pRenderer->PushProfileMarker(profileMarker);
AZ::FFont* font = static_cast<AZ::FFont*>(batch->m_font); // LYSHINE_ATOM_TODO - find a different solution from downcasting FFont to IFont
AZ::Data::Instance<AZ::RPI::Image> fontImage = font->GetFontImage();
if (fontImage)
@@ -1944,8 +1941,6 @@ void UiTextComponent::Render(LyShine::IRenderGraph* renderGraph)
isClampTextureMode, isTextureSRGB, isTexturePremultipliedAlpha, blendMode);
}
}
gEnv->pRenderer->PopProfileMarker(profileMarker);
}
}
@@ -97,7 +97,8 @@ namespace LyShineExamples
if (!texture)
{
// if there is no texture we will just use a white texture
texture = gEnv->pRenderer->EF_GetTextureByID(gEnv->pRenderer->GetWhiteTextureId());
// TODO: Get a default atom texture here when possible
//texture = gEnv->pRenderer->EF_GetTextureByID(gEnv->pRenderer->GetWhiteTextureId());
}
if (m_isRenderCacheDirty)