fix(oculus): provision stencil before render - #731
Draft
DecoderCoder wants to merge 1 commit into
Draft
Conversation
Prevent the first scope render from recreating main depth attachments after Oculus and Distant Horizons cache them.
DecoderCoder
force-pushed
the
1.20.1-render-compat-fixes
branch
from
August 4, 2026 08:11
1bb2dc5 to
a03d39b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
Refs #519
Refs Asek3/Oculus#797