Skip to content

chore(upscaling): Tracy GPU zone for SSR ReflectionsRayTracing#106

Merged
alandtse merged 2 commits into
devfrom
chore/tracy-ssr-zone
Jun 6, 2026
Merged

chore(upscaling): Tracy GPU zone for SSR ReflectionsRayTracing#106
alandtse merged 2 commits into
devfrom
chore/tracy-ssr-zone

Conversation

@alandtse

@alandtse alandtse commented Jun 6, 2026

Copy link
Copy Markdown
Owner

Adds a diagnostic-only Tracy GPU zone around the engine SSR raymarch pass (ISReflectionsRayTracing), so the pass is visible on the Tracy GPU timeline. Split out of #82 (foveated SSR) since it's independent profiling infrastructure, not part of the feature.

What it does

Wraps the SSR raymarch DRAW with a tracy::D3D11ZoneScope, opened on the shader's PreRender (vfunc 0x0A) and closed on PostRender (0x0B).

Why these hook points

RenderDoc callstacks proved the effect renders as a pixel-shader DRAW issued by the deferred batch renderer through the non-virtual BSImagespaceShader::Render — not the ImageSpaceManager vtable Render slot and not DispatchComputeShader (both of which were tried first and never fired). Render brackets the draw with the per-shader PreRender/PostRender vfuncs, which CommonLib keeps at stable indices across SE/AE/VR (the VR-only FakeDispatchComputeShader inserts at 0x0D, after them), so hooking 0x0A/0x0B on the cross-versioned ReflectionsRayTracing vtable wraps exactly the SSR draw on all three runtimes with no per-version addresses.

Safety

  • TRACY_ENABLE-gated — zero impact on shipping builds.
  • Behaviour-preserving: each thunk only chains the original vfunc.
  • Single raw zone holder is safe: render-thread only, non-nested for this shader; the PreRender thunk defensively closes any prior zone if PostRender were ever skipped.

Verified live (ALL-TRACY build): zone fires ~525/530 frames, ~88us baseline.

🤖 Generated with Claude Code

Copilot AI review requested due to automatic review settings June 6, 2026 03:04
@coderabbitai

coderabbitai Bot commented Jun 6, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@alandtse, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 4 minutes and 53 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 62aa351c-b4ef-4c4c-8c3d-e3d9c238e65e

📥 Commits

Reviewing files that changed from the base of the PR and between 3abd88a and 98683f4.

📒 Files selected for processing (1)
  • src/Features/Upscaling.cpp
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/tracy-ssr-zone

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

github-actions Bot commented Jun 6, 2026

Copy link
Copy Markdown

No actionable suggestions for changed features.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adds TRACY-only instrumentation to expose the engine’s SSR raymarch pass (ISReflectionsRayTracing) on the Tracy GPU timeline by hooking the shader’s PreRender/PostRender vfuncs and bracketing the draw with a D3D11 Tracy GPU zone.

Changes:

  • Introduces SSRPreRender_Hook / SSRPostRender_Hook to open/close a tracy::D3D11ZoneScope around the SSR draw (TRACY builds only).
  • Installs the hooks via stl::write_vfunc<0x0A/0x0B> on VTABLE_BSImagespaceShaderReflectionsRayTracing during Upscaling::PostPostLoad().
  • Adds logging to confirm installation when TRACY_ENABLE is defined.

Comment thread src/Features/Upscaling.cpp Outdated
Comment thread src/Features/Upscaling.cpp Outdated
Measure the engine SSR raymarch pass so the foveated-SSR saving is visible
on the GPU timeline. RenderDoc callstacks proved the effect renders as a
pixel-shader DRAW via the non-virtual BSImagespaceShader::Render (deferred
batch path), not the ImageSpaceManager vtable Render slot and not
DispatchComputeShader. Hook the per-shader PreRender (0x0A) and PostRender
(0x0B) vfuncs on the ReflectionsRayTracing vtable, which bracket the draw;
CommonLib keeps both at stable indices across SE/AE/VR (the VR-only
FakeDispatchComputeShader inserts at 0x0D, after them), so no per-version
addresses are needed. The GPU zone spans the two hooks.

Diagnostic-only (TRACY_ENABLE-gated), behaviour-preserving: each thunk only
chains the original vfunc.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@alandtse alandtse force-pushed the chore/tracy-ssr-zone branch from 5562348 to eb29b2d Compare June 6, 2026 03:17
@github-actions

github-actions Bot commented Jun 6, 2026

Copy link
Copy Markdown

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

Replace the per-frame new/delete of the D3D11ZoneScope with a static
std::optional (emplace/reset) so the diagnostic adds no heap traffic per frame
and can't skew the profile it measures. Behaviour identical; TRACY_ENABLE only.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings June 6, 2026 05:11

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.

Comment thread src/Features/Upscaling.cpp
Comment thread src/Features/Upscaling.cpp
@alandtse alandtse merged commit d640847 into dev Jun 6, 2026
20 checks passed
@alandtse alandtse deleted the chore/tracy-ssr-zone branch June 6, 2026 05:52
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