RenderSystem.assertOnRenderThread guards 74 of the 82 static methods in GlStateManager, but not _texImage2D, either overload of _texSubImage2D, _glBindFramebuffer, _glBlitFrameBuffer, _getTexLevelParameter, _viewport or getFrameBuffer, the texture upload calls among them. Around a hundred further GL33C calls elsewhere in the backend bypass GlStateManager altogether, so whether a call made from the wrong thread is caught depends on which entry point the path touches first rather than on the call being wrong.
writeToTexture shows both outcomes in one method. On a plain 2D texture it reaches _bindTexture, which asserts and throws before anything is issued. On a cubemap it takes the other branch and calls GL33C.glBindTexture directly, so a real GL call goes out on the wrong thread, and only the following _pixelStore raises. When a route with no guard is taken from the wrong thread, no exception is raised and the behaviour is undefined: the GL context belongs to the render thread, so the call may be silently dropped, or it may reach a context that is concurrently in use and leave the state machine in an inconsistent state. Either way the effect surfaces later as incorrect rendering that is hard to trace back and may not reproduce consistently.
Placing the check at the point where the backend is entered, rather than on individual state manager methods, would make the outcome depend on the thread instead of on the route, and would cover the direct GL33C calls that no per-method guard can reach.
Comments 2
Thank you for your report!
After consideration, the issue is being closed as Won't Fix.
Please note that this is not the same as Working as Intended, as this bug report correctly describes behavior in the game that might not be the intended or desirable behavior, but it will not be fixed right now. Sometimes, this is because the issue reported is minor and/or impossible to change without large architectural changes to the code base.
Quick Links:
📓 Bug Tracker Guidelines – 💬 Community Support – 📧 Mojang Support (Technical Issues) – 📧 Microsoft Support (Account Issues)
📓 Project Summary – ✍️ Feedback and Suggestions – 📖 Game Wiki
Can confirm.