View Issue Details

IDProjectCategoryView StatusLast Update
0002705NoesisGUIUnrealpublic2024-10-25 10:35
ReporterDavidJefferies Assigned Tohcpizzi  
PrioritynormalSeveritymajor 
Status feedbackResolutionopen 
Summary0002705: Async NoesisXAML loading results in texture loading errors
Description

In Unreal we've moved the loading of the Xaml files from disk to be asynchronous. This is because we want to be able to load/unload them during gameplay - the motivation here is that unloading the Xaml means its textures get unloaded as well.

We initiate the async load like this:

StreamableManager.RequestAsyncLoad(XamlObject.ToSoftObjectPath(), FStreamableDelegate::CreateRaw(this, &FViewLoader::OnXamlLoaded),
FStreamableManager::AsyncLoadHighPriority, false, false, "ViewLoader");

Then when its loaded we call LoadXaml on it

void FViewLoader::OnXamlLoaded()
{
UNoesisXaml* XamlFile = XamlObject.Get();
const Ptr<BaseComponent> Component = XamlFile->LoadXaml();
..
}
The issue we're having is sometimes the textures for the Xaml fail to load with the error message:

LogNoesis: Warning: Error loading '/Game;component/MyGame/Images/image_8.png', using fallback texture
Stepping through the code we can see that CreateTexture is failing because InTexture->GetResource() returns nullptr

Noesis::Ptr<Noesis::Texture> FNoesisRenderDevice::CreateTexture(UTexture* InTexture)
{
if (!InTexture || !InTexture->GetResource())
return nullptr;
..
}
The issue only occurs in a standalone build - never in editor - and seems to be timing related, sometimes it works fine sometimes it fails.

It looks like the textures haven't finished loading when CreateTexture tries to access them - the UTexture object exists but texture data doesn't yet

Any ideas what we can do to resolve it?

PlatformAny

Activities

hcpizzi

hcpizzi

2023-10-18 13:11

developer   ~0008842

I'm having trouble reproducing this issue.

First, just calling LoadXaml doesn't trigger Texture creation. That happens in the render thread while drawing. So, in my async load callback, I'm creating a NoesisInstance and adding it to the viewport.

Even adding this, all textures are loaded by the time the callback is called. I'm using a few pretty large textures, and I've tried both referencing directly from the XAML and from a ResourceDictionary, and both ways work fine. There must be something else that is different.

Where do those CreateTexture calls come from in your case?

I'm doing my testing with Unreal 5.3 (GitHub 5.3.0-release) and Noesis 3.2.2.

DavidJefferies

DavidJefferies

2023-10-20 12:42

reporter   ~0008859

We have a custom ContentControl that loads the Xaml from disk in an OnPropertyChanged function.
The Xaml is added to the view by calling SetContent()
UNoesisXaml* XamlFile = XamlObject.Get();
const Ptr<BaseComponent> Component = XamlFile->LoadXaml();
SetContent(Component);

The CreateTexture calls come from the Rendering Thread as you say - I've attached an image of the debugger breaking on the line that returns failure
We're currently on Unreal 5.3 and Noesis 3.2.1. We've applied a patch you provided to get those two versions to work together
We're upgrading to 3.2.2 in the next day or so - when that's finished I'll repro the issue again

image.png (355,295 bytes)
jsantos

jsantos

2024-10-25 10:35

manager   ~0010054

can we close this ticket?

Issue History

Date Modified Username Field Change
2023-09-29 14:34 hcpizzi New Issue
2023-09-29 18:21 jsantos Assigned To => hcpizzi
2023-09-29 18:21 jsantos Status new => assigned
2023-10-03 19:29 jsantos Target Version => 3.2.3
2023-10-10 19:10 jsantos Severity minor => major
2023-10-18 13:11 hcpizzi Note Added: 0008842
2023-10-20 12:42 DavidJefferies Note Added: 0008859
2023-10-20 12:42 DavidJefferies File Added: image.png
2023-10-24 12:45 jsantos Reporter hcpizzi => DavidJefferies
2024-01-22 11:47 sfernandez Target Version 3.2.3 => 3.2.4
2024-01-22 12:01 jsantos Status assigned => feedback
2024-06-05 17:38 jsantos Status feedback => assigned
2024-06-05 17:38 jsantos Target Version 3.2.4 => 3.2.5
2024-10-25 10:34 jsantos Status assigned => feedback
2024-10-25 10:34 jsantos Target Version 3.2.5 =>
2024-10-25 10:35 jsantos Note Added: 0010054