dsrour
Topic Author
Posts: 3
Joined: 12 Sep 2023, 23:12

Recreating NoesisView with the same content

12 Sep 2023, 23:20

We've integrated Noesis into an engine. We're wondering if there's a way to recreate or clone a view and its content (FrameworkElement).
We have a bunch of subsystems that create views. However, the engine's renderer could reset at anytime (due to rendering config changes or from switching gfx apis at runtime).
When this happens, we cannot simply get the view's renderer, shut it down and reinitialize it.

In Renderer::Shutdown(), there's a specific comment saying:
// mInitialized is left to true because we only support one Init()/Shutdown() cycle for now
To get around this, we do the following instead:
- GetContent() from the view
- Call Shutdown on the view's renderer and release the view
- Create a new view using the content from GetContent()

This works okay with some views, but not others.
For example, this work flow asserts with a specific view in TimeManager::AddMasterClock(...) where the target pointer member is NULL.

Is there a way to be able to change the View's renderer or recreate the same view and its content when the renderer changes?
Or are we forced to have each system using Noesis to reset themselves (destroy all views, states, and reinitialize)?

Thank you.
 
User avatar
jsantos
Site Admin
Posts: 4067
Joined: 20 Jan 2012, 17:18
Contact:

Re: Recreating NoesisView with the same content

13 Sep 2023, 20:00

To get around this, we do the following instead:
- GetContent() from the view
- Call Shutdown on the view's renderer and release the view
- Create a new view using the content from GetContent()
Theoretically this should work. Although it is a not well tested path. Could you please open a ticket about this?
Or are we forced to have each system using Noesis to reset themselves (destroy all views, states, and reinitialize)?
This is definitely the safest option, but probably the hardest to implement on your side, right?
 
dsrour
Topic Author
Posts: 3
Joined: 12 Sep 2023, 23:12

Re: Recreating NoesisView with the same content

14 Sep 2023, 19:16

Hello @jsantos.

I'll open up a ticket with further information.
This is definitely the safest option, but probably the hardest to implement on your side, right?
That would not be ideal indeed. It'd require quite a bit of refactoring instead of being able to automate this in a common logic for all views when the renderer is being reset.

Cheers.
 
 
User avatar
jsantos
Site Admin
Posts: 4067
Joined: 20 Jan 2012, 17:18
Contact:

Re: Recreating NoesisView with the same content

15 Sep 2023, 14:29

Thank you!

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot] and 1 guest