mojira.dev
MC-295893

Significant performance regressions with vertex/index buffer uploads

As part of 1.21.5’s rendering changes, the game stopped resizing and recreating the data inside of vertex and index buffers using glBufferData each time they needed to be uploaded and began to instead update the buffer’s data via glBufferSubData.

The problem is that on macOS (and potentially with other systems and drivers), the pipeline gets flushed when glBufferSubData is used which forces rendering to wait until that operation has completed and flushing the pipeline is very slow. I’ve observed this resulting in the loss of around 50-75% of my FPS depending on how frequently the vertex and index buffers are being uploaded. This issue can be especially slow with rendering the HUD as that can require that the vertex and index buffers be uploaded frequently for being drawn.

Code Analysis
The code responsible for uploading vertex and index buffers is located at GlCommandEncoder#writeToBuffer in Mojmap.

Inside this method there are three paths available for the given buffer to be uploaded, the first one uses glBufferSubData, the second uses glBufferData, and the third path uses both. Prior to 1.21.5 the second path was chosen for uploading the given buffer which avoids this issue, now due to 1.21.5’s changes in the rendering pipeline, the first path using glBufferSubData is the chosen one which triggers this performance regression.

Fix
The old method of simply resizing and recreating the vertex/index buffer data when uploading it does not force the pipeline to be flushed, thus reverting this change or providing a workaround for affected systems is enough to resolve the significant performance regressions caused by this issue.

Environment

MacOS 15.3.2 with M1 Pro chip

Linked issues

MC-295889 1.21.5 degrades performance Resolved MC-295978 Significant drop FPS on newest update Resolved MC-296013 Major Lag in version 1.21.5 Resolved MC-296005 Major lag after Update 1.21.5 Resolved MC-296126 Significant performance regression in 1.21.5 compared to 1.21.4 Resolved

Attachments

Comments 93

I will mark this as Plausible since I can confirm that 1.21.5 does seem to bring a performance regression (in the screenshots below, it’s roughly 15-20%, but I would believe it could be much higher depending on the situation).

[media][media]

The performance tanked a ridiculous amount for me, I don't feel like I can enjoy the game as much while it continues to run this poorly.

I'm running 1.21.5 on an Apple M3 Pro MacBook Pro with 18GB RAM and the game is almost unplayable for me now when I am in my single player base near a lot of entities. On 1.21.4, I had absolutely no problems, but now, I have very poor FPS. Others are reporting this issue running 1.21.5 on Apple Silicon in this Reddit thread.

Yes, I am the person who made the reddit thread above, I was making 130fps generally on realms, now dropping to, like the post and video within shows, 8/9fps… This is absurd… This “upgrade” has only been a “downgrade” for me

1.21.4 ran smooth as butter for me with “fancy” settings throughout. Since 1.21.5 the game is literally unplayable, even with everything switched down to lowest settings. This is on Java Realms with no mods/shaders/resource packs.

Happy to provide further info as needed.

83 more comments

Looks like the newest snapshot fixed the issue for me! Thank you Mojang developers

Still doesn’t work for me 😭

Latest snapshot only improves performance by 15-30% instead of the 80-100% needed to match 1.21.4 when using shaders that use vertex/index buffer uploads. It helps sure, but I can’t say on my end its “fixed”, there’s more at play. And this is using the latest drivers on my GTX 1060, which can complicate things since these and older GPUs use a different driver than that of the RTX 20 series and above.

I can confirm the Immediately Fast mod does correct the issue 100% on an ARM Mac. I was very reluctant to install any mods, and had lived with this bug for the past 4 months, but I couldn’t take it anymore so glad my game is back to normal, at least for now. I’m still on 1.21.5 though using the Fabric loader and the mod from a few comments back.

We’re on 1.21.8 and its still not fixed… I made an account specifically to vote for this in like June sometime. I can only play on my forever world with a render distance of 2 and no particles. I’m not very computer savvy so I don’t want to install mods. Please fix in 1.21.9

AzureAaron

(Unassigned)

Plausible

Platform

Important

Performance, Rendering

1.21.5, 25w15a, 25w16a, 25w17a, 25w18a, ..., 1.21.6, 1.21.7 Release Candidate 1, 1.21.7, 1.21.8 Release Candidate 1, 1.21.8

Retrieved