Skip to content

fix(oculus): provision stencil before render - #731

Draft
DecoderCoder wants to merge 1 commit into
MCModderAnchor:1.20.1from
DecoderCoder:1.20.1-render-compat-fixes
Draft

fix(oculus): provision stencil before render#731
DecoderCoder wants to merge 1 commit into
MCModderAnchor:1.20.1from
DecoderCoder:1.20.1-render-compat-fixes

Conversation

@DecoderCoder

@DecoderCoder DecoderCoder commented Aug 3, 2026

Copy link
Copy Markdown

What changed

Provision the main render target's stencil attachment during TACZ's existing Oculus compatibility initialization.

Why

The first scoped-weapon draw previously called RenderTarget.enableStencil() in the middle of hand rendering. Forge can recreate the main color and depth attachments at that point, after Oculus and Distant Horizons have cached the old depth texture. That can corrupt scope and water depth, expose distant LODs through foreground blocks, and invalidate queued rendering.

Provisioning stencil once before Oculus constructs its shader pipeline makes later render-time calls no-ops.

Standalone compatibility

OculusCompat.initCompat() is reached only when Oculus is loaded. Forge's enableStencil() is idempotent, and TACZ already uses the same API in its stencil rendering path. This adds no fork-only API and no Photon or Distant Horizons dependency; TACZ without Oculus is unchanged.

Validation

  • Gradle build passed on Java 17 against Forge 1.20.1-47.4.22
  • No TACZ test sources are present
  • Runtime-tested by the reporter with TACZ, Oculus, Photon, and Distant Horizons

Refs #519
Refs Asek3/Oculus#797

Prevent the first scope render from recreating main depth attachments after Oculus and Distant Horizons cache them.
@DecoderCoder
DecoderCoder force-pushed the 1.20.1-render-compat-fixes branch from 1bb2dc5 to a03d39b Compare August 4, 2026 08:11
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.

1 participant