Skip to content

chore(tracy): add GPU zone to ForEachLoadedFeature#2165

Merged
alandtse merged 3 commits into
community-shaders:devfrom
alandtse:tracy_zones
Apr 24, 2026
Merged

chore(tracy): add GPU zone to ForEachLoadedFeature#2165
alandtse merged 3 commits into
community-shaders:devfrom
alandtse:tracy_zones

Conversation

@alandtse
Copy link
Copy Markdown
Collaborator

@alandtse alandtse commented Apr 21, 2026

Introduce TracyD3D11 GPU zones in ForEachLoadedFeature via optional emitGpuZone param, wired through a static TracyD3D11Ctx set from State after device init. Remove manual BeginPerfEvent/TracyD3D11Zone calls from IBL now covered by the centralized path. Refine CPU zones in ScreenSpaceShadows, Skylighting, and TerrainBlending with callstack depth and named sub-zones for finer profiling granularity.

Co-Authored-By: Claude Sonnet 4.6 noreply@anthropic.com

Summary by CodeRabbit

  • Chores
    • Improved GPU profiling integration for several rendering passes to capture finer-grained timing.
    • Adjusted profiling scopes for skylighting, terrain depth, screen-space shadows, and prepass iterations.
    • Removed redundant profiling in the image-based lighting pass to reduce telemetry noise.
  • Documentation/Metadata
    • Bumped Skylighting and Terrain Blending shader feature metadata versions.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 21, 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: 31d3a6f0-9a08-4e7a-8530-e4015a3bbeef

📥 Commits

Reviewing files that changed from the base of the PR and between be25695 and b830965.

📒 Files selected for processing (9)
  • features/Skylighting/Shaders/Features/Skylighting.ini
  • features/Terrain Blending/Shaders/Features/TerrainBlending.ini
  • src/Deferred.cpp
  • src/Feature.h
  • src/Features/IBL.cpp
  • src/Features/ScreenSpaceShadows.cpp
  • src/Features/Skylighting.cpp
  • src/Features/TerrainBlending.cpp
  • src/State.cpp
💤 Files with no reviewable changes (1)
  • src/Features/IBL.cpp
✅ Files skipped from review due to trivial changes (4)
  • features/Skylighting/Shaders/Features/Skylighting.ini
  • features/Terrain Blending/Shaders/Features/TerrainBlending.ini
  • src/Features/ScreenSpaceShadows.cpp
  • src/Features/Skylighting.cpp

📝 Walkthrough

Walkthrough

Feature profiling integration updated: Feature::ForEachLoadedFeature gained an optional emitGpuZone flag and stored Tracy D3D11 context; State forwards the Tracy context to Feature; Deferred now calls ForEachLoadedFeature with emitGpuZone=true; several per-feature manual Tracy scopes were adjusted or removed.

Changes

Cohort / File(s) Summary
Feature profiling core
src/Feature.h, src/State.cpp, src/Deferred.cpp
Added Feature::SetTracyCtx(TracyD3D11Ctx) and extended ForEachLoadedFeature(methodName, callback, bool emitGpuZone = false) to optionally open a Tracy D3D11 GPU zone. State::SetupResources() forwards the created Tracy context. Deferred's three prepass iterations now pass emitGpuZone = true.
Feature instrumentation adjustments
src/Features/IBL.cpp, src/Features/ScreenSpaceShadows.cpp, src/Features/Skylighting.cpp, src/Features/TerrainBlending.cpp
Removed manual Tracy GPU/Perfetto scopes from IBL::Prepass(). Replaced/parameterized Tracy macros: ZoneScopedZoneScopedS(8) in ScreenSpaceShadows and TerrainBlending, added named ZoneScopedN scopes around TerrainBlending game-callback invocations, and added scoped profiling blocks inside Skylighting's projection/setup flows.
Feature metadata
features/Skylighting/Shaders/Features/Skylighting.ini, features/Terrain Blending/Shaders/Features/TerrainBlending.ini
Bumped feature versions: Skylighting 1-2-41-3-0, TerrainBlending 1-0-21-1-0.

Sequence Diagram(s)

sequenceDiagram
    participant State as State::SetupResources
    participant Deferred as Deferred (caller)
    participant FeatureMgr as Feature (static)
    participant FeatureInst as Feature instance (e.g., Skylighting)

    State->>FeatureMgr: Create TracyD3D11Ctx(device, context)
    State->>FeatureMgr: Feature::SetTracyCtx(tracyCtx)
    Deferred->>FeatureMgr: ForEachLoadedFeature("Prepass", callback, emitGpuZone=true)
    FeatureMgr->>FeatureMgr: if TRACY_ENABLE && emitGpuZone -> begin Tracy GPU zone
    FeatureMgr->>FeatureInst: invoke callback(feature) (calls feature->Prepass()/...)
    FeatureInst-->>FeatureMgr: return
    FeatureMgr->>FeatureMgr: if GPU zone started -> end Tracy GPU zone
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related issues

Possibly related PRs

Suggested reviewers

  • doodlum
  • jiayev
  • davo0411

Poem

🐰 I hopped where GPU timers glow,
Sent Tracy context down below,
Features called with zones anew,
Scopes trimmed, then stitched for view,
Hop—profiling hums and shows!

🚥 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 accurately summarizes the main change: adding GPU zones to ForEachLoadedFeature, which is the central feature introduced across Feature.h and integrated into State.cpp and multiple feature files.
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.

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: 1

🤖 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/State.cpp`:
- Around line 693-694: The call to Feature::SetTracyCtx(tracyCtx) is
unconditional but SetTracyCtx is only defined when TRACY_ENABLE is set; wrap the
call (or the surrounding statement(s) that reference tracyCtx) in the
appropriate TRACY_ENABLE preprocessor guard so non-Tracy builds compile, e.g.,
conditionally call Feature::SetTracyCtx only when TRACY_ENABLE is defined after
creating tracyCtx from TracyD3D11Context; reference tracyCtx, TracyD3D11Context
and Feature::SetTracyCtx when locating the fix.
🪄 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: b4832d12-3660-4ccb-849e-7d7ec1ab0592

📥 Commits

Reviewing files that changed from the base of the PR and between ab5eec0 and 879c554.

📒 Files selected for processing (7)
  • src/Deferred.cpp
  • src/Feature.h
  • src/Features/IBL.cpp
  • src/Features/ScreenSpaceShadows.cpp
  • src/Features/Skylighting.cpp
  • src/Features/TerrainBlending.cpp
  • src/State.cpp
💤 Files with no reviewable changes (1)
  • src/Features/IBL.cpp

Comment thread src/State.cpp
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 22, 2026

No actionable suggestions for changed features.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 22, 2026

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

alandtse and others added 3 commits April 22, 2026 22:33
Introduce TracyD3D11 GPU zones in ForEachLoadedFeature via optional
emitGpuZone param, wired through a static TracyD3D11Ctx set from
State after device init. Remove manual BeginPerfEvent/TracyD3D11Zone
calls from IBL now covered by the centralized path. Refine CPU zones
in ScreenSpaceShadows, Skylighting, and TerrainBlending with callstack
depth and named sub-zones for finer profiling granularity.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Feature::SetTracyCtx only exists when TRACY_ENABLE is defined;
unconditional call breaks non-Tracy builds.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@alandtse alandtse merged commit c1065c0 into community-shaders:dev Apr 24, 2026
15 checks passed
ParticleTroned pushed a commit to ParticleTroned/skyrim-community-shaders that referenced this pull request May 2, 2026
…#2165)

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
(cherry picked from commit c1065c0)
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