Skip to content

[Fix] (texture): map GL_DEPTH_COMPONENT32 to GL_DEPTH_COMPONENT32F for GLES - #49

Open
ryanmurf wants to merge 1 commit into
MobileGL-Dev:mainfrom
ryanmurf:pr/depth-component32
Open

[Fix] (texture): map GL_DEPTH_COMPONENT32 to GL_DEPTH_COMPONENT32F for GLES#49
ryanmurf wants to merge 1 commit into
MobileGL-Dev:mainfrom
ryanmurf:pr/depth-component32

Conversation

@ryanmurf

Copy link
Copy Markdown

Maps the desktop-GL internal format GL_DEPTH_COMPONENT32 (0x81A7) to GL_DEPTH_COMPONENT32F in internal_convert(), and adds it to is_depth_format(). Without this, Minecraft 26.x cannot allocate its main depth texture through MobileGlues.

Why

Minecraft 26.x (GlDevice.createTexture in the new blaze3d GL device) allocates its depth attachment with:

glTexImage2D(target, 0, GL_DEPTH_COMPONENT32 /* 33191 */, w, h, 0, GL_DEPTH_COMPONENT, GL_FLOAT, NULL)

GL_DEPTH_COMPONENT32 is a desktop GL sized format that does not exist in GLES 3.x, so the call fails (GL_INVALID_ENUM/GL_INVALID_OPERATION depending on driver) and the game bails out during framebuffer creation. The closest GLES 3.0 sized depth format is GL_DEPTH_COMPONENT32F, which requires type = GL_FLOAT — the type Minecraft already passes; the conversion forces it regardless for safety.

Found while getting Minecraft 26.1.2 running in Amethyst (PojavLauncher iOS successor), but the format mapping applies to any platform where MobileGlues backs a desktop-GL app.

Testing

  • Built via the Amethyst-iOS CI (Xcode 26.3, iOS SDK) and run on an iPad Pro (iPadOS 26.5) with Minecraft 26.1.2: depth texture allocation no longer errors. (On iOS this also needs the companion Apple symbol-lookup fix, PR'd separately.)
  • Minecraft 1.21.x unaffected (uses GL_DEPTH_COMPONENT24 path).

…r GLES

Minecraft 26.x (GlDevice.createTexture) allocates its main depth texture
with internalformat GL_DEPTH_COMPONENT32 (0x81A7) and type GL_FLOAT.
GLES 3.x has no GL_DEPTH_COMPONENT32; the allocation fails and the game
cannot create its framebuffer. Map it to the sized GL_DEPTH_COMPONENT32F
(forcing type GL_FLOAT) and treat it as a depth format in
is_depth_format().
@ryanmurf

Copy link
Copy Markdown
Author

On-device confirmation: with this fix (plus #50 making the layer actually active on Apple), Minecraft 26.1.2's depth attachment allocates fine and the game renders correctly / is fully playable on iPad Pro (M1, iPadOS 26.5) via Amethyst. Tested build: AngelAuraMC/Amethyst-iOS#293.

@Swung0x48

Swung0x48 commented Aug 12, 2026

Copy link
Copy Markdown
Member

This is a too-wide fix. 32F (8-bit exp + 24-bit fract) has less precision than 32 in near-zero range. This can cause problems with shadows of some shaderpacks. Don’t put this format conversion/substitution here as it will affect globally. (Potentially breaking rendering of certain shaders)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants