Dorako / pf2e-dorako-ux

MIT License
4 stars 7 forks source link

Excessive GPU load when Adjust Token Effects HUD is enabled #17

Closed Codas closed 7 months ago

Codas commented 7 months ago

Hello there. Please let me say first of all that I LOVE your module and it's one of the modules I have grown to consider mandatory for myself at least. Foundry really looks soo much more modern and every module update just makes it better!

There is one feature I have a love/hate relationship with however. I love how the adjusted token effects HUD looks, I have however noticed that this feature alone increases my GPU load by as much as 50%, slightly depending on the scene and amount of tokens with effects in it. This is a screenshot of my GPU activity monitor with the setting disabled (20 fps, MacOS, Chrome, Hardware Acceleration active)

Bildschirmfoto 2024-03-10 um 21 53 46

The following screenshot is from the same machine, same world, same zoom elevel and everything, but with "Adjust Token Effects HUD" enabled

Bildschirmfoto 2024-03-10 um 21 56 28

In parts even dropping frames in 20 fps mode. This might not really show the "50% increased gpu load" claim above, but looking at framerates I can archive maybe 27FPS with the setting enabled and about 50FPS with the setting disabled.

This is only for context, my question or issue is the following: Is there a way to optimize this code a bit? My understanding and limited debugging knowledge for GPU based code is that core foundry uses essentially one draw call to draw those token status icons (maybe even for all Icons on screen), whereas the adjusted HUD setting changes this to be (I think) one draw call per icon, which might explain the decreased performance. This is at leaset 50% guesswork though and with no clear advise of how to optimize the code.

Which Is also why I would like to propose another solution or workaround: Could this setting maybe be changed from a GM only world-based setting to a Client-side setting, so that those people with laptops or more limited systems could deactivate it if needed?

Again thank you for the terrific module!

Dorako commented 7 months ago

The feature is pretty hacked together, and I have next to no PIXI knowledge or understanding of the Foundry graphics pipeline, so it's unlikely that I'll do any optimization. Considering how many people like it, I'd rather keep fingers crossed that it'll be a core Foundry option at some point.

As for making it a client setting, I can definitely do that.

Dorako commented 7 months ago

Included in 1.3.3, out now