promotional bannermobile promotional banner

Window Resize Fix (Iris & Distant Horizons)

Fixes Distant Horizons breaking after a window resize with Iris, and the world's depth buffer not following a replaced render target.
mzg | Window Resize Fix (Iris & Di...
Create a server, get 25% off your first monthaffiliate logo
Create Server
affiliate banner image

What this is

A small client mod that fixes two depth-buffer defects in Iris, both of which come from the same place: Iris does not own a depth buffer for the world, it borrows Minecraft's — and it decides when to re-borrow it from a counter that cannot answer the question being asked.

Minecraft 1.21.1 / NeoForge 21.1.x. Nothing is written to your world.

Fix 1 — Distant Horizons dies after you resize the window

No render-scaling mod required. This one affects plain Iris + Distant Horizons.

Drag the edge of the game window, or go in or out of fullscreen, and Distant Horizons stops drawing. It stays broken until you reload the world.

The cause: when Iris resizes its render targets it walks every framebuffer it owns and hangs Minecraft's depth texture on each — and the Distant Horizons framebuffers are on that list, though they must keep DH's own depth. The reconnect that would put it back is guarded by a check on the texture's id, and DH's id never changed. Only the attachment did. So nothing ever restores it.

This mod clears the remembered id at the head of that reconnect, so Iris's own code re-attaches normally.

Fix 2 — the world's depth does not follow a replaced render target

If you use anything that renders the world at a resolution other than the window's — a render scaler, a dynamic resolution mod — Iris ends up drawing into colour buffers of one size against a depth buffer of another. Distant Horizons LODs draw on top of everything, and the world can come out stretched or doubled.

The cause, read out of Iris's compiled code:

// RenderTargets.resizeIfNeeded    and    DHCompatInternal.reconnectDHTextures
if (depthBufferVersion != cachedDepthBufferVersion) { /* only here is a new depth taken */ }

That counter answers "has this target recreated its buffers?" It cannot answer "is this a different target now?" — which is exactly what happens when another mod hands Minecraft a different main render target.

The advice usually given for the symptom is "resize the game window until it fixes itself". That works precisely because resizing makes Minecraft recreate its target, which bumps the counter.

This mod compares the depth texture's id, and the Distant Horizons texture's size, instead of the counter. In ordinary play that is one integer comparison per frame.

What is proven and what is not

Both defects are read directly from Iris 1.8.14's bytecode, and fix 1 is confirmed in play: with the mod installed the log shows the DH depth texture being re-attached as the world resolution changes, and DH keeps rendering.

What has not been done is a controlled before/after against the open upstream report whose symptoms match fix 2 (RenderScale#59). The mechanism is proven; the claim "this fixes that issue" is not made here. During development, one picture defect that looked exactly like it turned out to have a completely unrelated cause — another mod leaking a viewport in the middle of the frame.

Requirements

Minecraft 1.21.1, NeoForge 21.1.x, Iris. Distant Horizons optional — without it, fix 1 simply has nothing to act on.

License

MIT.

The Window Resize Fix (Iris & Distant Horizons) Team

profile avatar
Owner
  • 10
    Projects
  • 1.6K
    Downloads

More from mzgView all

  • Technologia.create project image

    Technologia.create

    A NeoForge 1.21.1 Create-focused modpack blending factory automation, cannons, aeronautics, trains, and liquid fuel with cozy farming, cooking, and decoration mods for an industrial-meets-rustic survival experience.

    • 119
    • August 14, 2026
  • TFMG Electricity Performance Patch project image

    TFMG Electricity Performance Patch

    Fixes the per-tick electrical network rebuild loop and the quadratic network update in Create: The Factory Must Grow.

    • 358
    • August 12, 2026
  • Ghost Names project image

    Ghost Names

    Player name tags disappear from the world. Right-click someone and their name fades in for ten seconds, then fades away. Tab list untouched, client side only.

    • 139
    • August 12, 2026
  • Gear Vanish project image

    Gear Vanish

    Turn your armor into cosmetics: hide it, or keep only the trim glowing on bare skin. Synced to everyone, with rules that bring gear back when it matters.

    • 162
    • August 12, 2026
  • Technologia.create project image

    Technologia.create

    A NeoForge 1.21.1 Create-focused modpack blending factory automation, cannons, aeronautics, trains, and liquid fuel with cozy farming, cooking, and decoration mods for an industrial-meets-rustic survival experience.

    • 119
    • August 14, 2026
  • TFMG Electricity Performance Patch project image

    TFMG Electricity Performance Patch

    Fixes the per-tick electrical network rebuild loop and the quadratic network update in Create: The Factory Must Grow.

    • 358
    • August 12, 2026
  • Ghost Names project image

    Ghost Names

    Player name tags disappear from the world. Right-click someone and their name fades in for ten seconds, then fades away. Tab list untouched, client side only.

    • 139
    • August 12, 2026
  • Gear Vanish project image

    Gear Vanish

    Turn your armor into cosmetics: hide it, or keep only the trim glowing on bare skin. Synced to everyone, with rules that bring gear back when it matters.

    • 162
    • August 12, 2026