Blaze3D has functionality for copying one texture into another using copyTextureToTexture but this function uses incorrect coordinates:
copyTextureToTexture has the following signature:
public void copyTextureToTexture(
final GpuTexture source,
final GpuTexture destination,
final int mipLevel,
final int destX,
final int destY,
final int sourceX,
final int sourceY,
final int width,
final int height
) {It calls blitFramebuffers on the DirectStateAccess of the device:
blitFrameBuffers(this.readFbo, this.drawFbo, sourceX, sourceY, width, height, destX, destY, width, height, isDepth ? 256 : 16384, 9728);blitFramebuffers has the following signature:
abstract void blitFrameBuffers(
int source, int dest, int srcX0, int srcY0, int srcX1, int srcY1, int dstX0, int dstY0, int dstX1, int dstY1, int mask, int filter
);This translates directly into an OpenGL call (glBlitNamedFramebuffer or glBlitFramebuffer).
The issue is the following: glBlitNamedFramebuffer / blitFrameBuffers expect framebuffer rectangle coordinates (X0, Y0), (X1,Y1) but the code passes the top left coordinate and width/height.
I suspect the reason why this hasn’t been discovered yet is because copyTextureToTexture is only used in the vanilla game by RenderTarget#copyDepthFrom in which case destX,destY,sourceX,sourceY are all zero, which conveniently makes the issue not appear in this case. If the function is used by the game in the future or used by mods, it copies the wrong region of the source framebuffer to the wrong region in the destination framebuffer.
Comments 3
Thanks for your report! This bug was marked as Invalid because of a formal requirement that we currently have: an issue needs to be affecting the game to be considered a bug. The errors in the code that do not manifest themselves outwardly are not accepted as valid bugs.
But your report is valuable and we will address the issue anyway. We will discuss internally if the rule should change.
I’m glad this report helped. I was unsure of whether this issue should have been reported to the bugs.mojang.com site or through the MINECRAFT FEEDBACK discord server that was suggested to me for Blaze3D related issues. I think it would be valuable to have some development related bugs site or a Github with an issues section for when there are errors in Blaze3D or features that would both benefit the development of the game and of mods. Thank you for quickly addressing this issue
Thank you for your report!
After consideration, the issue is being closed as Invalid.
This report does not describe a bug.
Quick Links:
📓 Bug Tracker Guidelines – 💬 Community Support – 📧 Mojang Support (Technical Issues) – 📧 Microsoft Support (Account Issues)
📓 Project Summary – ✍️ Feedback and Suggestions – 📖 Game Wiki