Skip to content

fix(VR): skip kSAO_CAMERAZ RTV in depth pass#2192

Merged
doodlum merged 1 commit into
community-shaders:devfrom
alandtse:fix/vr-sao-cameraz-rtv
Apr 23, 2026
Merged

fix(VR): skip kSAO_CAMERAZ RTV in depth pass#2192
doodlum merged 1 commit into
community-shaders:devfrom
alandtse:fix/vr-sao-cameraz-rtv

Conversation

@alandtse
Copy link
Copy Markdown
Collaborator

@alandtse alandtse commented Apr 23, 2026

Summary

  • kSAO_CAMERAZ is allocated at per-eye (half-stereo) resolution in VR (e.g. 4299×4565) but the fullscreen depth upscale draw uses a full-stereo viewport (8598×4565)
  • This causes the pixel shader to write garbage into the left-eye region of kSAO_CAMERAZ
  • The engine's own ISSAOCameraZ pass correctly populates kSAO_CAMERAZ, so we only need to stop corrupting it
  • Fix: pass nullptr for RTV slot 1 in VR, matching the engine's own pass behavior

Test plan

  • Build ALL preset
  • Test in VR — no kSAO_CAMERAZ rendering artifacts in left-eye

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Fixed an issue causing corruption of VR stereo output during the upscaling process.

kSAO_CAMERAZ is allocated at per-eye (half-stereo) resolution in VR but
the fullscreen draw uses a full-stereo viewport, causing the PS to write
garbage into the left-eye region. Pass nullptr for RTV slot 1 in VR to
match the engine's own ISAOCameraZ pass behavior.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 23, 2026

📝 Walkthrough

Walkthrough

The Upscaling::UpscaleDepth pass was modified to prevent VR stereo output corruption by conditionally binding render target views. The RTV array now includes nullptr for VR instead of saoCameraZ.RTV, while maintaining the render-target slot configuration.

Changes

Cohort / File(s) Summary
VR Stereo Render Target Fix
src/Features/Upscaling.cpp
Modified the depth-refraction upscaling pass to conditionally bind render targets, using nullptr for VR stereo and saoCameraZ.RTV for standard rendering to prevent output corruption.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Suggested reviewers

  • doodlum
  • davo0411

Poem

🐰 A fix for the stereo sight so clear,
Where render targets disappear,
In VR's world, no binding for the view,
Just nullptr where it's due,
Depth now flows without a glitch—hooray! 🎮✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and accurately summarizes the main change: skipping the SAO_CAMERAZ render target in the depth pass for VR to prevent corruption of stereo output.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown

No actionable suggestions for changed features.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
src/Features/Upscaling.cpp (1)

1934-1938: Fix looks correct; consider tightening the comment wording.

The nullptr RTV in VR correctly avoids writing the full-stereo viewport into the per-eye kSAO_CAMERAZ target, and ISSAOCameraZ already populates it. Behavior-wise this matches the PR intent.

Minor nit: the comment says kSAO_CAMERAZ is at "quarter-stereo resolution" and that corruption hits "the top-left quarter", but per the PR description the RT is per-eye (half-width × full-height of the stereo target), and the observed artifact is in the left-eye region. Consider aligning the wording with the PR description to avoid future confusion.

✏️ Suggested comment tweak
-		// kSAO_CAMERAZ is at quarter-stereo resolution in VR; the full-stereo viewport would
-		// corrupt only the top-left quarter. The engine's ISSAOCameraZ pass populates it correctly.
+		// kSAO_CAMERAZ is allocated at per-eye (half-stereo) resolution in VR, so a full-stereo
+		// viewport would write garbage into the left-eye region. The engine's ISSAOCameraZ pass
+		// already populates this target correctly, so skip binding it here in VR.
 		ID3D11RenderTargetView* rtvs[] = { refractionNormals.RTV,
 			globals::game::isVR ? nullptr : saoCameraZ.RTV };
 		context->OMSetRenderTargets(2, rtvs, depth.views[0]);

Also, as per coding guidelines, consider shortening the PR title to fit the 50-char limit, e.g. fix(vr): skip kSAO_CAMERAZ RTV in depth upscale (lowercase scope, ≤50 chars).

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/Features/Upscaling.cpp` around lines 1934 - 1938, The comment above the
rtvs initialization is slightly misleading about kSAO_CAMERAZ resolution and
artifact location; update the comment near the ID3D11RenderTargetView* rtvs[]
block (references: rtvs, saoCameraZ.RTV, kSAO_CAMERAZ, ISSAOCameraZ,
globals::game::isVR) to state that kSAO_CAMERAZ is a per-eye target (half-width
× full-height of the stereo target) and the observed corruption appears in the
left-eye region, and note that the ISSAOCameraZ pass already populates the
target so we intentionally pass nullptr for VR to avoid writing the full-stereo
viewport. Also apply the suggested shorter PR title when creating the changelist
(e.g., "fix(vr): skip kSAO_CAMERAZ RTV in depth upscale").
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@src/Features/Upscaling.cpp`:
- Around line 1934-1938: The comment above the rtvs initialization is slightly
misleading about kSAO_CAMERAZ resolution and artifact location; update the
comment near the ID3D11RenderTargetView* rtvs[] block (references: rtvs,
saoCameraZ.RTV, kSAO_CAMERAZ, ISSAOCameraZ, globals::game::isVR) to state that
kSAO_CAMERAZ is a per-eye target (half-width × full-height of the stereo target)
and the observed corruption appears in the left-eye region, and note that the
ISSAOCameraZ pass already populates the target so we intentionally pass nullptr
for VR to avoid writing the full-stereo viewport. Also apply the suggested
shorter PR title when creating the changelist (e.g., "fix(vr): skip kSAO_CAMERAZ
RTV in depth upscale").

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 20428c3d-1724-44e9-aa48-f53ce5b393f8

📥 Commits

Reviewing files that changed from the base of the PR and between 6d5be8f and 9e585bd.

📒 Files selected for processing (1)
  • src/Features/Upscaling.cpp

@github-actions
Copy link
Copy Markdown

✅ A pre-release build is available for this PR:
Download

@doodlum doodlum merged commit a8f2e52 into community-shaders:dev Apr 23, 2026
14 checks passed
ParticleTroned pushed a commit to ParticleTroned/skyrim-community-shaders that referenced this pull request May 2, 2026
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
(cherry picked from commit a8f2e52)
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