Infamous-Misadventures / Dungeons-Gear

A mod that ports Minecraft Dungeons items to Minecraft
MIT License
49 stars 22 forks source link

[1.18.2] Low FPS issues (maybe GUI related) #198

Closed MarioSMB closed 9 months ago

MarioSMB commented 1 year ago

I've noticed a signficant FPS drop when using the mod, and I suspect it's related to the new GUI elements; having the mod installed drops my frames a bit, the more artifacts slotted the lower my framerate, the soul bar may be adding to the lag a bit.

Patrigan commented 1 year ago

This has been reported by someone else. I am still looking for solutions, but apparently this is Minecraft's rendering code that is gobbling up some resources. We reduced the amount of things to render in recent versions to reduce the impact (went from 17% to 11% of the rendering cycle). But we had to lose some stuff, like black border around the text.

I am still running tests, as my impression is that other mods adding GUI elements should have the same issue.

MarioSMB commented 1 year ago

So... I've been playing around with this a bit, and it looks like there's only a small FPS drop with the GUIs rendered, but the moment you slot any artifacts the framerate starts to take a heavy dip (with up to 70 FPS lost when all 3 are slotted). Putting artifacts in the inventory hotbar so they're still rendered on screen doesn't cause this dip in frames, so there must be something wrong with the rendering of Curios on screen, presumably.
I have a sneaking suspicion this is related to the keybind text rendering underneath the items - something is misbehaving here!

MarioSMB commented 1 year ago

Another fun tidbit: with isHidden set to true on both the GUI elements, I'm still getting a massive framerate drop with 3 artifacts slotted!

MarioSMB commented 1 year ago

Here's a Spark profile run with both GUIs hidden and 3 artifacts slotted, seeing a lot of render calls strangely: https://spark.lucko.me/V4CrFNlIoi
The functions it references don't even seem to exist in the source code, so I'm at a bit of a dead end here, hopefully this is useful to the team.

Patrigan commented 1 year ago

image Interestingly, the issue no longer exists on 1.19.2 https://spark.lucko.me/1ceuCvKWUs

I'm currently wondering in how far I want to still put effort in this :(

MarioSMB commented 1 year ago

If that's the case then it looks like the solution is a fairly simple one; a quick diff reveals RenderGuiOverlayEvent being used instead of RenderGameOverlayEvent in the 1.19 branch.
I'm not sure how well-maintained the 1.18 branch is moving forward, though backporting a fix for a major lag issue might be worth considering!

Thelnfamous1 commented 9 months ago

1.18 is no longer supported.