NotEnoughItems Unofficial 1.7.10

NotEnoughItems Unofficial 1.7.10

436k Downloads

Low FPS when rendering items

telinit opened this issue ยท 2 comments

commented

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

2023-06-10_00-58-39

The problem

2023-06-10_00-53-26

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:

  1. In the older versions of NEI GL11.glEnable(GL12.GL_RESCALE_NORMAL); call was enabled by default without any checks (see fb9d517)
  2. 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"

2023-06-10_01-09-09

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:
image

Useful stuff

Minecraft logs:
mc.log

VisualVM profiler snapshots:
snapshots.zip

commented

Is the FPS still bad when the item rendering cache is enabled without your changes? I added it to address these types of issues.

commented

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.