- nevayeshirazi
- Posts: 9
- Joined:
Crashes on Unreal Render Thread When Dynamic RenderTransform Used
Hello,
I am dynamically setting the ScaleX and ScaleY properties of ScaleTransform from the Unreal Engine DataContext which is a UObject.
Without the render transform, widget works as expected. However, based on the player position I am trying to scale down the size of the widget and to do that, I set the Scale property on DataContext to number between 0 and 1. With this approach, during gameplay sometimes i receive an exception at DeferredShadingRenderer.cpp
function. Just before the exception, I can see that one of the widget on the screen scales incorrectly. It is bigger than it should be. Could this be a bug or am I doing something wrong? You can see my XAML and Stack trace below.
Thanks in advance.
I am dynamically setting the ScaleX and ScaleY properties of ScaleTransform from the Unreal Engine DataContext which is a UObject.
Without the render transform, widget works as expected. However, based on the player position I am trying to scale down the size of the widget and to do that, I set the Scale property on DataContext to number between 0 and 1. With this approach, during gameplay sometimes i receive an exception at DeferredShadingRenderer.cpp
Code: Select all
void FDeferredShadingSceneRenderer::Render(FRDGBuilder& GraphBuilder)
Thanks in advance.
Code: Select all
<UserControl
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:noesis="clr-namespace:NoesisGUIExtensions"
RenderTransformOrigin="0.5,1">
<UserControl.RenderTransform>
<ScaleTransform ScaleX="{Binding Scale}" ScaleY="{Binding Scale}" />
</UserControl.RenderTransform>
<Grid HorizontalAlignment="Center">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<TextBlock x:Name="ActorName" Grid.Row="0" Text="{Binding ActorName}" Foreground="#ede8e2" FontSize="22" HorizontalAlignment="Center" FontWeight="Bold" noesis:Text.Stroke="Gray" noesis:Text.StrokeThickness="1" />
<TextBlock x:Name="Title" Grid.Row="1" Text="Granmaster Warrior" HorizontalAlignment="Center" FontSize="19" FontWeight="Bold" />
<ProgressBar x:Name="PlayerWinsProgress" Grid.Row="2" Height="10" Minimum="0" Maximum="100" Value="2" Width="160" Background="#FFCE2323" Margin="0,10,0,0">
</ProgressBar>
</Grid>
</UserControl>
Code: Select all
FDeferredShadingSceneRenderer::Render(FRDGBuilder &) DeferredShadingRenderer.cpp:4404
RenderViewFamilies_RenderThread(FRHICommandListImmediate &, const TArray<…> &) SceneRendering.cpp:4571
`FRendererModule::BeginRenderingViewFamilies'::`87'::<lambda_3>::operator()(FRHICommandListImmediate &) SceneRendering.cpp:4846
TEnqueueUniqueRenderCommandType<`FRendererModule::BeginRenderingViewFamilies'::`87'::FDrawSceneCommandName,`FRendererModule::BeginRenderingViewFamilies'::`87'::<lambda_3> >::DoTask(Type,const TRefCountPtr<FGraphEvent> &) RenderingThread.h:209
TGraphTask<TEnqueueUniqueRenderCommandType<`FRendererModule::BeginRenderingViewFamilies'::`87'::FDrawSceneCommandName,`FRendererModule::BeginRenderingViewFamilies'::`87'::<lambda_3> > >::ExecuteTask(TArray<FBaseGraphTask *,TSizedDefaultAllocator<32> > &,Type,bool) TaskGraphInterfaces.h:1265
[Inlined] FBaseGraphTask::Execute(TArray<…> &, Type, bool) TaskGraphInterfaces.h:866
FNamedTaskThread::ProcessTasksNamedThread(int, bool) TaskGraph.cpp:758
FNamedTaskThread::ProcessTasksUntilQuit(int) TaskGraph.cpp:648
RenderingThreadMain(FEvent *) RenderingThread.cpp:411
FRenderingThread::Run() RenderingThread.cpp:562
FRunnableThreadWin::Run() WindowsRunnableThread.cpp:146
FRunnableThreadWin::GuardedRun() WindowsRunnableThread.cpp:71
Re: Crashes on Unreal Render Thread When Dynamic RenderTransform Used
Hi,
I think the top of the callstack may be missing. The crash may come from FNoesisSceneViewExtension::PrePostProcessPass_RenderThread, but I don't really see how the change you mention may be related to a crash in that function.
Aren't there any frames missing from the top of this callstack? And what's the exception information from the debugger's output window?
Thanks!
I think the top of the callstack may be missing. The crash may come from FNoesisSceneViewExtension::PrePostProcessPass_RenderThread, but I don't really see how the change you mention may be related to a crash in that function.
Aren't there any frames missing from the top of this callstack? And what's the exception information from the debugger's output window?
Thanks!
- nevayeshirazi
- Posts: 9
- Joined:
Re: Crashes on Unreal Render Thread When Dynamic RenderTransform Used
Hey, thanks for the response.
I think I figured it out.
Below is how I am creating my widget. I am creating a UObject data context and set it on widget via SetDataContext. I thought, since the context was set on Widget, it would not be garbage collected but they are getting collected. I am not sure why i get the exception on render thread but adding the DataContext to root in UE via AddToRoot() prevented the GC and I no longer receive the render thread exception.
I think I figured it out.
Below is how I am creating my widget. I am creating a UObject data context and set it on widget via SetDataContext. I thought, since the context was set on Widget, it would not be garbage collected but they are getting collected. I am not sure why i get the exception on render thread but adding the DataContext to root in UE via AddToRoot() prevented the GC and I no longer receive the render thread exception.
Code: Select all
UEDPlayerNameplateVM* DataContext = NewObject<UEDPlayerNameplateVM>();
UNoesisInstance* Widget = CreateWidget<UNoesisInstance>(World.Get(), UNoesisInstance::StaticClass());
Widget->BaseXaml = Cast<UNoesisXaml>(UISubsystem->GetXaml());
Widget->SetDataContext(DataContext);
Re: Crashes on Unreal Render Thread When Dynamic RenderTransform Used
We don't keep references to those objects, but the case of a DataContext UObject being garbage collected should be handled without crashing, definitely not from the render thread.
I'll try to reproduce it, but if you could provide us the complete callstack and exception details, that would be great :)
I'll try to reproduce it, but if you could provide us the complete callstack and exception details, that would be great :)
Who is online
Users browsing this forum: Arca INC, Bing [Bot] and 4 guests