chore(vr): add Tracy zones for SSS dispatches#2217
Conversation
Add GPU/CPU profiling zones around the StereoBlendCS dispatch (conditional Overwrite vs Bilateral name), the VRStereoOptimizations mode-classify CS (with Bind and Dispatch sub-zones) and stencil write pass, and per-eye SSS dispatches (Left Eye, Right Eye) with per-sweep sub-zones (DispatchEye CB, DispatchEye Sweep) inside the DispatchEye lambda. Recent VR perf investigation revealed these passes had no Tracy visibility, making cost measurement impossible. The SSS inner-loop zone is renamed from "SSS - Ray March" to the more descriptive sub-zones. Risk: none. TracyD3D11Zone and ZoneScoped compile out entirely when TRACY_SUPPORT is not enabled. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
📝 WalkthroughWalkthroughThis PR refactors Tracy profiling instrumentation across three VR/stereo rendering features. ScreenSpaceShadows reorganizes shadow dispatch zones into separate constant-buffer and compute phases with per-eye labeling. StereoBlend adds per-branch profiling zones for overwrite vs. bilateral dispatch modes. VRStereoOptimizations adds instrumentation around stereo stencil classification and write passes, separating shader binding from dispatch operations. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
|
No actionable suggestions for changed features. |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/Features/ScreenSpaceShadows.cpp (1)
232-246: Optional: consider an outer Tracy zone for the non-VR path for symmetry.In VR, both
DispatchEyecalls are wrapped in"SSS - Left Eye"/"SSS - Right Eye". The non-VR call at Line 233 has no analogous outer zone, so the per-sweep zones appear directly under"Screen Space Shadows". Functionally fine (no profiling gap), but a"SSS - Mono"(or similar) wrapper would make Tracy traces structurally consistent across VR/non-VR captures. Up to you.♻️ Optional symmetry tweak
if (!globals::game::isVR) { - DispatchEye(nullptr, GetComputeRaymarch(), lightProjectionF.data(), InvTexSizeX, InvTexSizeY); + TracyD3D11Zone(globals::state->tracyCtx, "SSS - Mono"); + DispatchEye(nullptr, GetComputeRaymarch(), lightProjectionF.data(), InvTexSizeX, InvTexSizeY); } else {🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/Features/ScreenSpaceShadows.cpp` around lines 232 - 246, Non-VR path lacks an outer Tracy zone for symmetry with the VR branch, so wrap the single DispatchEye call so profiling traces match both branches; when globals::game::isVR is false, add a TracyD3D11Zone (e.g., "SSS - Mono") around the call that invokes DispatchEye(nullptr, GetComputeRaymarch(), lightProjectionF.data(), InvTexSizeX, InvTexSizeY) so it mirrors the "SSS - Left Eye"/"SSS - Right Eye" zones used when calling GetComputeRaymarchRight() and CalculateLightProjection(1).
🤖 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/ScreenSpaceShadows.cpp`:
- Around line 232-246: Non-VR path lacks an outer Tracy zone for symmetry with
the VR branch, so wrap the single DispatchEye call so profiling traces match
both branches; when globals::game::isVR is false, add a TracyD3D11Zone (e.g.,
"SSS - Mono") around the call that invokes DispatchEye(nullptr,
GetComputeRaymarch(), lightProjectionF.data(), InvTexSizeX, InvTexSizeY) so it
mirrors the "SSS - Left Eye"/"SSS - Right Eye" zones used when calling
GetComputeRaymarchRight() and CalculateLightProjection(1).
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 0f2097f0-83ea-4c93-a84d-d2faacf8364a
📒 Files selected for processing (3)
src/Features/ScreenSpaceShadows.cppsrc/Features/VR/StereoBlend.cppsrc/Features/VRStereoOptimizations.cpp
|
✅ A pre-release build is available for this PR: |
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com> (cherry picked from commit c614997)
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Summary
Adds Tracy GPU and CPU profiling zones around VR stereo passes and per-eye Screen Space Shadows dispatches. No logic changes — instrumentation only.
Why
Recent VR perf investigation surfaced significant per-frame cost in the
VRStereoOptimizationsandStereoBlendpasses that was previously invisible in Tracy captures. Without these zones, future VR perf work — both validating optimizations and identifying further targets — cannot be measured. The instrumentation gap was the single biggest blocker on data-driven VR perf decisions.What
Eight zone categories across three files:
src/Features/VR/StereoBlend.cpp—StereoBlend - Overwrite/StereoBlend - Bilateral(conditional onisOverwriteMode).src/Features/VRStereoOptimizations.cpp—StereoOpt - Stencil Write,StereoOpt - Mode Classify(parent), withMode Classify BindandMode Classify Dispatchsub-zones.src/Features/ScreenSpaceShadows.cpp—SSS - Left Eye/SSS - Right Eyeouter zones at theDispatchEyecall sites inDrawShadows(). The pre-existingSSS - Ray Marchzone inside the Bend dispatch loop was renamed and split intoSSS - DispatchEye CB(CB upload per sweep) andSSS - DispatchEye Sweep(the dispatch itself), giving per-sweep granularity. Net effect: the loop is more profilable, not less.Risk
Zero. Tracy macros (
TracyD3D11Zone,ZoneScoped) compile to nothing whenTRACY_SUPPORT=OFF(the default).Validation
./BuildRelease.bat ALL(default preset,TRACY_SUPPORT=OFF). No warnings introduced; the only build warning is an unrelatedextern/FidelityFX-SDKCMake deprecation.ALL-TRACYwill surface the new zones for validation. Sample data (from a test build of these zones on a downstream branch) showedStereoOpt - Mode Classifyat ~306 µs/frame andStereoBlend - Overwriteat ~303 µs/frame — costs that were entirely invisible before.Summary by CodeRabbit