sp614x / optifine

1.81k stars 417 forks source link

[1.12.2] Slow chunk loading on Linux with VBOs OFF, glNewList(-1) #3069

Open sp614x opened 4 years ago

sp614x commented 4 years ago

From Barteks2x:

Could optifine for 1.12.2 fix an issue where MC is attempting to use display lists with ID -1 when VBOs are off, causing changing render distance to be very slow on linux mesa drivers?

It's very closely related to what I reported here https://bugs.mojang.com/browse/MC-162522 But in 1.12.2 basically the class I don't remember the name of contains display list id and has a check for "is layer used" and if it's not, it returns -1. But the code that actually uses this method and calls glNewList is called when isLayerStarted is true and these don't necessarily match so mc ends up calling glNewList with list -1 and that has the same result as using vertex buffer -1 in the linked issue Ie it permanently changes mesa internal state such that glGenLists is much slower (curiously opengl specification doesn't specify it as error condition for display lists (but doesn't specify it as allowed either) to use display list not returned by glGenLists. It is an error condition for vbo but apparently all implementations ignore it)

sp614x commented 4 years ago

Looks like a race condition between loading and uploading chunks. It also affects 1.14.4 and probably all older versions down to 1.8.x as the code is identical.

sp614x commented 4 years ago

ListedRenderChunk.getDisplayList() returns -1 if the layer is not started, this can get out of sync with the chunk loading thread and from time to time glNewList(-1) is called. No GL errors are generated.

jtyliu commented 2 years ago

Hey, I'm that one guy who thinks they have this problem. I'm on linux with an amd gpu.

When I have VBO on and switch between worlds, it randomly ramps up the gpus fans and takes several seconds to switch worlds. Right now, I can't seem the find any fixes online so I'm just going to leave this here anyone else is having this problem.