Skip to content

chore(VR): remove dead reprojection code#2061

Merged
davo0411 merged 4 commits into
community-shaders:devfrom
alandtse:reproj_fix2
Apr 6, 2026
Merged

chore(VR): remove dead reprojection code#2061
davo0411 merged 4 commits into
community-shaders:devfrom
alandtse:reproj_fix2

Conversation

@alandtse
Copy link
Copy Markdown
Collaborator

@alandtse alandtse commented Apr 4, 2026

Summary by CodeRabbit

  • Documentation

    • Clarified stereo reprojection UI label and added a descriptive hover tooltip.
  • Refactor

    • Streamlined stereo optimization pipeline and gating so VR reprojection/merge runs only when required resources are ready.
    • Made mode/resource bindings more reliable across frames.
  • Chores

    • Adjusted default forward occlusion scale from 0.2 to 0.1 for improved performance.

@alandtse alandtse changed the title chore: remove dead reprojection code chore(VR): remove dead reprojection code Apr 4, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 4, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 537e77da-e533-4366-80e4-222c0ff1ecf3

📥 Commits

Reviewing files that changed from the base of the PR and between 8a9689b and 0c2e0a2.

📒 Files selected for processing (7)
  • package/Shaders/VRStereoOptimizations/ReprojectionCS.hlsl
  • src/Deferred.cpp
  • src/Features/VR.h
  • src/Features/VR/StereoBlend.cpp
  • src/Features/VRStereoOptimizations.cpp
  • src/Features/VRStereoOptimizations.h
  • src/Globals.cpp
💤 Files with no reviewable changes (1)
  • package/Shaders/VRStereoOptimizations/ReprojectionCS.hlsl
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/Globals.cpp

📝 Walkthrough

Walkthrough

The reprojection compute shader and its dispatch were removed; stereo reprojection is replaced by the stereo blend path. New readiness gating and stencil-swap tracking were added; shader/resource compilation and dispatch for reprojection were deleted and related settings/defaults adjusted.

Changes

Cohort / File(s) Summary
Shader Removal
package/Shaders/VRStereoOptimizations/ReprojectionCS.hlsl
Deleted the reprojection compute shader file and its entrypoint/resources.
Deferred / Render Hooks
src/Deferred.cpp, src/Globals.cpp
Gated stencil dispatch in StartDeferred() with new culling-ready check; call stereoOpt.NoteStencilSwap() in OMSetDepthStencilState hook; updated a comment referencing stereo overwrite blend pass.
VR Feature Helpers
src/Features/VR.h
Added IsStereoOptimizationCullingReady() to centralize readiness checks for stereo optimization/culling.
Stereo Optimization Core
src/Features/VRStereoOptimizations.h, src/Features/VRStereoOptimizations.cpp
Removed DispatchReprojection(), reprojection shader/resource management, and reprojection dispatch flow; added CanDispatchStencil() and NoteStencilSwap(); changed Settings::forwardOcclusionScale default from 0.2f0.1f; adjusted ImGui label/tooltip to reference stereo reprojection/overwrite blend and removed reprojection shader compilation/clear.
Stereo Blend Usage
src/Features/VR/StereoBlend.cpp
VR::DrawStereoBlend() now uses IsStereoOptimizationCullingReady() for decisions; removed the early-return that depended on debugSkipMerge, altering control flow for that case.

Sequence Diagram(s)

sequenceDiagram
    participant Frame
    participant Deferred as Deferred::StartDeferred
    participant VRFeat as globals::features::vr
    participant StereoOpt as VRStereoOptimizations
    participant GPU as GPU/Shaders

    Frame->>Deferred: Begin frame
    Deferred->>VRFeat: globals::features::vr.IsStereoOptimizationCullingReady()
    alt culling ready
        Deferred->>StereoOpt: Dispatch stencil classification
        StereoOpt->>VRFeat: NoteStencilSwap() (via OMSetDepthStencilState hook)
    end
    Frame->>VRFeat: VR::DrawStereoBlend()
    VRFeat->>VRFeat: compute vrStereoOptActive via IsStereoOptimizationCullingReady()
    alt use overwrite blend
        VRFeat->>GPU: Bind overwrite blend CS / resources
        GPU-->>VRFeat: Execute stereo overwrite blend
    else normal blend
        VRFeat->>GPU: Bind normal blend path
        GPU-->>VRFeat: Execute stereo blend
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • doodlum

Poem

🐰
I hopped through frames with curious cheer,
A shader shelved, the blend draws near.
Stencils counted, swaps noted true,
The pipeline hums — a fresher view.
Hooray! 🥕✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 22.22% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: removing the ReprojectionCS.hlsl shader and associated DispatchReprojection() code path from the VR stereo optimization system.

✏️ 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

github-actions Bot commented Apr 4, 2026

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.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/Deferred.cpp`:
- Around line 283-285: DeferredCompositeCS can read stale texPerPixelMode if
DispatchStencil() is skipped; update DeferredPasses() to only bind
texPerPixelMode to slot 16 when the same stencil-readiness gate used to call
DispatchStencil() is true (e.g.
globals::features::vr.IsStereoOptimizationCullingReady() or
stereoOpt.IsStencilActive()), and explicitly bind a null SRV (nullptr) to slot
16 when that gate is false so the compute shader cannot early-out based on stale
data; make this change near the existing stereoMode/texPerPixelMode binding
logic to mirror the DispatchStencil() condition.

In `@src/Features/VR.h`:
- Around line 129-135: The helper IsStereoOptimizationCullingReady must mirror
the actual pass prerequisites: either extend it to include the stencil and blend
resources or create two dedicated checks CanDispatchStencil() and
CanDrawStereoBlend() and use them where DispatchStencil() and DrawStereoBlend()
are called; ensure each check validates REL::Module::IsVR(), stereoOpt.loaded,
stereoOpt.settings.stereoMode != VRStereoOptimizations::StereoMode::Off,
!stereoOpt.settings.debugSkipMerge and the specific DirectX resources (for
stencil: the same resources DispatchStencil() requires; for blend:
stereoBlendOverwriteCS, stereoBlendCopyTex and stereoBlendCB) and return false
if any are null so the outer pipeline never assumes readiness when a later stage
will early-out.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 4e4c6bbf-445e-40be-b6f9-acb0efd8c7a4

📥 Commits

Reviewing files that changed from the base of the PR and between abeb11b and 8a9689b.

📒 Files selected for processing (6)
  • package/Shaders/VRStereoOptimizations/ReprojectionCS.hlsl
  • src/Deferred.cpp
  • src/Features/VR.h
  • src/Features/VRStereoOptimizations.cpp
  • src/Features/VRStereoOptimizations.h
  • src/Globals.cpp
💤 Files with no reviewable changes (1)
  • package/Shaders/VRStereoOptimizations/ReprojectionCS.hlsl

Comment thread src/Deferred.cpp
Comment thread src/Features/VR.h Outdated
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 4, 2026

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

@davo0411 davo0411 merged commit 97da3d2 into community-shaders:dev Apr 6, 2026
17 checks passed
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