mojira.dev
MC-310357

The OpenGL rendering backend passes 3 to `GL_UNPACK_ALIGNMENT`, which is invalid

GL_UNPACK_ALIGNMENTinteger: 1, 2, 4, or 8

https://registry.khronos.org/OpenGL-Refpages/gl4/html/glPixelStore.xhtml

@Override
public void writeToTexture(
   final GpuTexture destination,
   final ByteBuffer source,
   final int mipLevel,
   final int depthOrLayer,
   final int destX,
   final int destY,
   final int width,
   final int height
) {
   int target;
   if ((destination.usage() & 16) != 0) {
      target = GlConst.CUBEMAP_TARGETS[depthOrLayer % 6];
      GL33C.glBindTexture(34067, ((GlTexture)destination).id);
   } else {
      target = 3553;
      GlStateManager._bindTexture(((GlTexture)destination).id);
   }

   GlStateManager._pixelStore(3314, width);
   GlStateManager._pixelStore(3316, 0);
   GlStateManager._pixelStore(3315, 0);
   GlStateManager._pixelStore(3317, destination.getFormat().componentCount()); // here, byteAlignement() should be used
   GlStateManager._texSubImage2D(target, mipLevel, destX, destY, width, height, GlConst.toGlExternalId(destination.getFormat()), 5121, source); // 5121 is hardcoded, should use GlConst toGlType, no?
}

Comments 1

Can confirm. One nit on the report text is the constant is
GL_UNPACK_ALIGNMENT, not GL_PACK_ALIGNMENT. This is an upload path, governed by UNPACK, PACK(0x0D05 / 3333) only applies to reads like glReadPixels. Same 1/2/4/8 constraint either way, so the defect stands unchanged.

Lolo

RogueLogix

Community Consensus

Platform G

Normal

Rendering

26.3 Snapshot 5

26.3 Snapshot 6

Retrieved