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

Attachments

Comments 65

clamlol

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]
LordDrewpicus

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.

Nick Zmudzinski

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.

Joseph Blakemore

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

Jacen

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.

55 more comments
Ceresjanin123

Insight from RaphiMC:
”The buffer upload regression in 1.21.5 does not affect all systems. It mostly affects Apple GPUs. Avoiding glBufferSubData on all systems causes a performance decrease on most GPU drivers. ImmediatelyFast <=1.21.4 in fact even has an optimization which replaces glBufferData with glBufferSubData because its measureably faster on most systems.

It should be noted that 1.21.5 has multiple other performance regressions, even ones which affect all GPU vendors, so direct comparisons between 1.21.4 and 1.21.5 even with the buffer upload fix are not possible.”

glorp64

Affects 25w21a

RenatusX

@Ceresjanin123 Unfortunately I am part of the population who uses nvidia GPUs (RTX 4060 Ti) and is still impacted by this regression hard.

flimcraft

I am able to play 1.21.4 very happily at 720p on a raspberry pi 5, around 60fps in most cases. I upgraded to 1.21.5 and it’s unplayably slow at all the same settings, less than half the framerate and crashes when traveling fast. Was psyched to have a really low power computer that could play this game, would love to get the performance from 1.21.4 back!

Phineas196

I tried the Snapshot 3 version of 1.21.6, still not fixed.

AzureAaron

(Unassigned)

Plausible

Platform

Important

Performance, Rendering

1.21.5, 25w15a, 25w16a, 25w17a, 25w18a, ..., 25w20a, 25w21a, 1.21.6 Pre-Release 1, 1.21.6 Pre-Release 2, 1.21.6 Pre-Release 3

Retrieved