-
Notifications
You must be signed in to change notification settings - Fork 888
Description
Synopsis
When some third-party launchers (Feather, Lunar, etc) are used with Sodium, the world stops rendering correctly due to what we believe is our shared index buffer being corrupted. This issue first appeared with version 25.10.2 of the AMD Graphics Driver, and user reports have rapidly increased in frequency as the update has rolled out to more computers over the last week.
We have not observed this behavior with any of the other launchers we support (Prism, Modrinth, and Mojang's launcher.)
Analysis
The sequence of calls into the driver for allocating this buffer and writing the index data is especially trivial:
GLuint buffer;
glGenBuffers(1, &buffer);
glBindBuffer(GL_ARRAY_BUFFER, buffer);
glBufferData(GL_ARRAY_BUFFER, length, NULL, GL_STATIC_DRAW);
void* ptr = glMapBufferRange(GL_ARRAY_BUFFER, 0, length, GL_MAP_WRITE_BIT | GL_INVALIDATE_BUFFER_BIT);
// ... write data into (ptr)
glUnmapBuffer(GL_ARRAY_BUFFER);We're very confident this code is correct, and it has never caused problems before.
Yet for some reason, calling glMapBufferRange produces nonsensical errors from the AMD graphics driver:
Driver function parameter <target> has an invalid enum '0x3' (GL_INVALID_ENUM)
(Note that even more strangely, the "invalid enum" 0x3 is an integer that increases by one each time glMapBufferRange is called -- this makes no sense, and this isn't even a valid error to return.)