mojira.dev
MC-223021

glShaderSource fails on some AMD drivers resulting in a crash on 1.17

AMD drivers ship with a bug that causes a crash on some glShaderSource calls. This causes the game to crash randomly when loading a world and almost every time when reloading resource packs when graphics settings are set to fabulous. A crash dump is attached to this issue

This issue isn't directly Minecraft's fault, but the bug has been present for almost a year and so a workaround would be ideal.

This can be "fixed" by replacing the GL20.glShaderSource call inΒ com.mojang.blaze3d.platform.GlStateManager.glShaderSource with

final MemoryStack stack = MemoryStack.stackGet();
final int stackPointer = stack.getPointer();

try {
   StringBuilder builder = new StringBuilder();
   for (String string : strings) {
      builder.append(string);
   }
   final ByteBuffer sourceBuffer = MemoryUtil.memUTF8(builder.toString(), true);
   final PointerBuffer pointers = stack.mallocPointer(1);
   pointers.put(sourceBuffer);
   GL20C.nglShaderSource(shader, 1, pointers.address0(), 0);
   org.lwjgl.system.APIUtil.apiArrayFree(pointers.address0(), 1);
} finally {
   stack.setPointer(stackPointer);
}

Linked issues

Attachments

Comments 1

⚠️ Please do not mark Unreleased Versions as affected. You don't have access to them yet.

We have removed it and added the latest released version

Please edit the Affects Version/s field and select the specific Released Version you were using when you encountered the reported issue.

If you can't find it in the list, please make sure that:

  • You are in the correct project on the bug tracker.

  • You were playing the latest release version or the latest development version of the game.

This issue is being temporarily closed as Awaiting Response. Once the requested information has been delivered, the report will be reopened automatically.

Quick Links:
πŸ““ Bug Tracker Guidelines – πŸ’¬ Community Support – πŸ“§ Mojang Support
πŸ““ Project Summary – ✍️ Feedback and Suggestions – πŸ“– Game Wiki
-- I am a bot. This action was performed automatically! Please report any issues on Discord or Reddit

BalintCsala

Felix Jones

Plausible

Very Important

Crash, Rendering

21w14a

1.17 Pre-release 1

Retrieved