Low FPS when rendering items
telinit opened this issue ยท 2 comments
Description
So the problem is that item rendering on the right side of the NEI GUI is extremely slow. FPS drops to something like 6-12 when browsing a full (unfiltered) page of items on a 2k monitor with medium GUI scaling. It's not "unplayable" but still annoying.
System setup
The problem
I ran the VisualVM profiler to understand what's going on there. And I saw that the most time-consuming method calls were glGetBoolean
and glGetInteger
(from this method). I looked into the source code of the mod and guessed that I could try to disable these API calls because:
- In the older versions of NEI
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
call was enabled by default without any checks (see fb9d517) - The
checkMatrixStack
method calls in my opinion are used to check the correctness of some graphics state and a failed check will lead to an exception which will crash the game anyway.
The "solution"
So I've checked out this commit d86c472 and made some stubs in place of the method calls I mentioned before and got a good improvement in FPS - it became much higher, like 35-60.
Possible cause and some thoughts
I think that this might be an OpenGL driver bug. I tried to downgrade the nvidia driver from 530.41.03 to 525.89.02 but it didn't help.
Not sure if my "solution" of the problem is safe. It could at least cause some visual glitches and other bugs. Or some memory leaks at worst. I'm not a 3D developer so I'm not sure how to fix this. I think I'll keep my modified version of the mod while the bug is still here.
Edit: it seems like this modification breaks item rendering cache:
Useful stuff
Minecraft logs:
mc.log
VisualVM profiler snapshots:
snapshots.zip
Is the FPS still bad when the item rendering cache is enabled without your changes? I added it to address these types of issues.
Is the FPS still bad when the item rendering cache is enabled without your changes? I added it to address these types of issues.
When I tested it last time (before I made my changes) it did improve the FPS significantly but some items were not rendered at all and all items were not animated.