I’m on my last leg of critical optimizations for game and getting close, but I’m running into a new ADT performance problem. For context: Been developing recently on new Macbook w AMD Radeon Pro 5500M 4GB (good card). Now I’m trying to optimize it on my iMac retina with a, semi meh AMD Radeon R9 M395 2048 MB, at retina sizes (0.5 hardware scaling level) – Everything I’ve tested on runs fine if I downscale to 1.0 hardware scaling, but I haven’t been able to get > 30 FPS on imac at 0.5 HWS since nearly when I started project. (Runs fine at 0.5 now on MBP)
I’ve known ADT was my problem for awhile, as it’s a card game and was using it for all the cards as well as the card in play’s attributes – But I just finished refactoring to using ALMOST no ADT, minus one part where it’s needed, and seeing a big performance hit still on imac at 0.5 (also should mention 3840x2116, not running it full screen).
Attaching screenshot below as much easier to visualize.
As mentioned in screenshot, previously there was up to > 100 ADT’s per match, (1 per card), at 1024x1024 each. Which even my new MBP would eventually run the GPU out of memory or something and slow down to 10-20 FPS, but no longer does that after refactor. - But imac still unable to render the ADT in a performant manner (10-20 FPS). If I skip building the description attributes or disable the player hands, it jumps back up to 50+.
The refactor I did (along with turning all the card (attributes/frame/number values into instanced sprite meshes using basis compression) was to Dynamically fill 4096x4096 ADT’s with GUI Grid controls, and then each card adds its own text to one of the textures when it’s created. So 1 512x512 texture per card, which allows me to limit to 2 4096x4096 ADT per match, for the most part (They will be dynamically allocated if I need more), then I pass the ADT to a custom shader which uses it like a sprite by setting instancedBuffers – But even with just the two 4096 textures (or 1), it tanks the performance down to 10-20. So I’m wondering if there is a setting I could be missing, or something I’m not understanding about what it’s doing (It’s not rendering new data to the canvas even if the texture hasn’t changed is it? I’m also using invalidRect optimization so I would think that if nothing is changing, performance should be stable.)
Things I’ve tried to no avail:
- noMipmaps = true,false (Which I’m still not sure if I want or don’t want mipmaps for this. The cards can go from small to big i.e. when being drawn or hovered, so I think maybe I do want mipmaps?)
- material.freeze() on the ADT materials
- useSmallestIdeal = true
- checkReadyOnEveryCall = false
- useBitmapCache = false,true
(Also, pointer events are turned off i.e.
this.texture = BABYLON.GUI.AdvancedDynamicTexture.CreateForMesh(this.mesh, this.width, this.height, false);
So I’m wondering if there is another setting that could free up performance, or something that could be causing the drastic frame drop that someone is aware of?
Any ideas would be much appreciated