From 3eed53fa272f8ae38a873320d1283e3543a197c1 Mon Sep 17 00:00:00 2001 From: Terry Michaels <81711813+tjmichaels@users.noreply.github.com> Date: Fri, 30 Apr 2021 19:41:46 -0500 Subject: [PATCH] Crash fixes in LyShine with pRenderer being nullptr now (#496) --- Gems/LyShine/Code/Source/UiParticleEmitterComponent.cpp | 5 ----- Gems/LyShine/Code/Source/UiTextComponent.cpp | 5 ----- Gems/LyShineExamples/Code/Source/UiCustomImageComponent.cpp | 3 ++- 3 files changed, 2 insertions(+), 11 deletions(-) diff --git a/Gems/LyShine/Code/Source/UiParticleEmitterComponent.cpp b/Gems/LyShine/Code/Source/UiParticleEmitterComponent.cpp index a2fdfa201f..e54f61fbfa 100644 --- a/Gems/LyShine/Code/Source/UiParticleEmitterComponent.cpp +++ b/Gems/LyShine/Code/Source/UiParticleEmitterComponent.cpp @@ -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); } //////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/Gems/LyShine/Code/Source/UiTextComponent.cpp b/Gems/LyShine/Code/Source/UiTextComponent.cpp index b1092ab92f..937f323b01 100644 --- a/Gems/LyShine/Code/Source/UiTextComponent.cpp +++ b/Gems/LyShine/Code/Source/UiTextComponent.cpp @@ -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(batch->m_font); // LYSHINE_ATOM_TODO - find a different solution from downcasting FFont to IFont AZ::Data::Instance fontImage = font->GetFontImage(); if (fontImage) @@ -1944,8 +1941,6 @@ void UiTextComponent::Render(LyShine::IRenderGraph* renderGraph) isClampTextureMode, isTextureSRGB, isTexturePremultipliedAlpha, blendMode); } } - - gEnv->pRenderer->PopProfileMarker(profileMarker); } } diff --git a/Gems/LyShineExamples/Code/Source/UiCustomImageComponent.cpp b/Gems/LyShineExamples/Code/Source/UiCustomImageComponent.cpp index 80750efe7f..cb33ccac98 100644 --- a/Gems/LyShineExamples/Code/Source/UiCustomImageComponent.cpp +++ b/Gems/LyShineExamples/Code/Source/UiCustomImageComponent.cpp @@ -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)