Hello!
I’m trying to resolve UE-67487 (at least in a hacky, works on my machine, way), and I just had some questions about the approach I’m taking.
I’ve tracked down the large computation time of opening a menu is rooted in the fact that:
- Opening a menu creates a brand new SWindow every time, and therefore creates a new Viewport for every open (under SWindow::ShowWindow() in
!bHasEverBeenShown
conditional) - Calling
FSlateApplicationBase::Get().GetRenderer()->CreateViewport( SharedThis( this ) );
for opening these windows takes a really long time (20-40 ms)
Two broad approaches could be taken:
- Reuse the same Viewport for menus not unlike how Tooltips behave. This would cause a long open time for the first time a menu is opened, but really fast every time after that
- Improve the performance of
CreateViewport
on Vulkan/Linux
From the surface, option 2 sounds like a more complicated, time consuming approach, so I’m favoring option 1. However, I’m not quite sure if creating a single Viewport that all menus will reuse is viable due just looking at the Viewport configuration options being generated. It may behoove me to just sustain a Viewport (via a sustained SWindow and/or FMenu) for each menu and just show/hide the NativeWindow whenever the menu needs to be shown
There is maybe a potential 3rd option that I don’t fully understand. It seems there may be some reuse logic in SMenuAnchor
if GetPopupMethod() == EPopupMethod::UseCurrentWindow
. It seems this value happens if the popup is Hosted
; what is a Hosted
popup? Is it viable to use this for the editor menus?
I’ll keep digging as I was able to come up with a “good enough for me” solution for UE-25471 to prevent FPS performance issues for tooltips.
However, it would be great to get some perspective from the code owners to help guide me towards some solution for this 1.5 year old issue that Linux users have been dealing with (It’s basically a deal breaker for developer experience to me). I’m happy to Zoom (or other teleconference) to throw some ideas around.
Thanks!