Skip to content

build: bump tracy to 0.13.1#1761

Closed
alandtse wants to merge 4 commits into
community-shaders:devfrom
alandtse:tracy_update
Closed

build: bump tracy to 0.13.1#1761
alandtse wants to merge 4 commits into
community-shaders:devfrom
alandtse:tracy_update

Conversation

@alandtse
Copy link
Copy Markdown
Collaborator

@alandtse alandtse commented Jan 25, 2026

Depends on #1760

Summary by CodeRabbit

  • New Features

    • Enhanced performance profiling with improved Tracy instrumentation across rendering and compilation operations.
    • Added formal vcpkg package support for Tracy dependency management.
  • Chores

    • Refactored internal feature iteration mechanism for improved efficiency.

✏️ Tip: You can customize this high-level summary in your review settings.

Copilot AI review requested due to automatic review settings January 25, 2026 11:36
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jan 25, 2026

📝 Walkthrough

Walkthrough

This pull request integrates Tracy profiling support through vcpkg, introduces a centralized feature iteration helper with automatic Tracy instrumentation, and adds profiling zones throughout the codebase. Additionally, it updates the CMake build configuration and removes the Tracy override from vcpkg.json.

Changes

Cohort / File(s) Summary
Tracy vcpkg Port Configuration
cmake/ports/tracy/build-tools.patch, cmake/ports/tracy/portfile.cmake, cmake/ports/tracy/vcpkg.json
Establishes Tracy as a vcpkg port with feature-driven tool inclusion (cli-tools: csvexport, capture, import, update; gui-tools: profiler), CMake build configuration, PDB/license handling, and cross-platform constraint definitions.
Feature Iteration Refactoring
src/Feature.h, src/Deferred.cpp, src/State.cpp, src/XSEPlugin.cpp
Introduces templated Feature::ForEachLoadedFeature() helper method that centralizes feature iteration with conditional Tracy zone instrumentation. Updates multiple call sites to use the new helper, removing manual loaded-check loops and delegating zone creation to the utility.
Profiling Instrumentation
src/State.cpp, src/ShaderCache.cpp, src/Features/ScreenSpaceShadows.cpp
Adds ZoneScoped and ZoneScopedN profiling markers around feature method calls and shader compilation tasks. Simplifies per-eye Tracy zone naming in ScreenSpaceShadows from dynamic per-eye labels to a uniform constant label.
VCpkg Configuration Cleanup
vcpkg.json
Removes the Tracy override entry (version 0.11.0), allowing vcpkg to use the newly integrated port instead.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~30 minutes

Possibly related PRs

  • refactor(interior sun): rename interior sun shadows #1387: Both PRs modify the feature registry/iteration system—this PR introduces Feature::ForEachLoadedFeature and updates call sites, while the related PR changes feature list/names in Feature.cpp/Globals, touching the same feature-iteration surfaces.

Suggested reviewers

  • doodlum

Poem

🐰 Hop, hop! Tracy traces our way,
Features iterate with style today,
Zones wrap the code with profiling care,
Rabbits debug with flair to spare! 🎭

🚥 Pre-merge checks | ✅ 2 | ❌ 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 (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'build: bump tracy to 0.13.1' accurately describes the main change - updating the Tracy dependency to version 0.13.1.

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

✨ Finishing touches
  • 📝 Generate docstrings

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

Using provided base ref: a077f9e
Using base ref: a077f9e
Base commit date: 2026-01-25T01:56:31-08:00 (Sunday, January 25, 2026 01:56 AM)
No actionable suggestions for changed features.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request bumps the Tracy profiler library from version 0.11.0 to 0.13.1 by creating a custom vcpkg port overlay. The PR depends on #1760, which introduced the ForEachLoadedFeature helper function that adds Tracy CPU profiling zones to feature lifecycle methods.

Changes:

  • Creates custom vcpkg port for Tracy 0.13.1 with build tools patch
  • Removes Tracy version override from main vcpkg.json (now using custom port)
  • Adds Tracy CPU profiling zones to State::Draw() method calls
  • Adds Tracy profiling to shader compilation tasks
  • Simplifies TracyD3D11Zone usage in ScreenSpaceShadows

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated no comments.

Show a summary per file
File Description
vcpkg.json Removes Tracy 0.11.0 version override, delegating to custom port overlay
cmake/ports/tracy/vcpkg.json Defines custom Tracy 0.13.1 port with features and dependencies
cmake/ports/tracy/portfile.cmake Implements vcpkg build logic for Tracy 0.13.1 from GitHub
cmake/ports/tracy/build-tools.patch Patches Tracy's CMake to support building command-line and GUI tools
src/XSEPlugin.cpp Refactors feature lifecycle calls to use ForEachLoadedFeature helper (from #1760)
src/State.cpp Adds ZoneScoped profiling zones to State::Draw() and refactors feature iteration
src/Deferred.cpp Updates tracyCtx references and refactors feature prepass iterations
src/ShaderCache.cpp Adds ZoneScoped profiling to shader compilation tasks
src/Features/ScreenSpaceShadows.cpp Simplifies TracyD3D11Zone usage by removing unused tracyName variable
src/Feature.h Adds Tracy header include for TRACY_ENABLE macro (from #1760)

@alandtse alandtse closed this Jan 25, 2026
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

🤖 Fix all issues with AI agents
In `@cmake/ports/tracy/portfile.cmake`:
- Around line 31-52: The build is missing tool configuration and copying for
debug builds because TOOLS_OPTIONS is only in OPTIONS_RELEASE and
tracy_copy_tool always uses the "-rel" directory; move ${TOOLS_OPTIONS} from the
OPTIONS_RELEASE block into the OPTIONS block of the vcpkg_cmake_configure call
so tool-related CMake options are applied for all build types, and update the
tracy_copy_tool function to inspect VCPKG_BUILD_TYPE (or default to release) and
choose the proper search directory suffix (e.g., "-rel" for release, "-dbg" or
"-debug" for debug) when building SEARCH_DIR from
${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}<suffix>/${tool_dir}.

In `@src/Feature.h`:
- Around line 4-6: Feature.h is not self-contained because
Feature::ForEachLoadedFeature uses std::format but the header doesn't include
<format>; add an `#include` <format> to Feature.h (near other includes or after
Tracy include guard) so the declaration/inline use of ForEachLoadedFeature
compiles in translation units that don't already include <format>.
🧹 Nitpick comments (1)
src/ShaderCache.cpp (1)

2648-2650: Avoid double GetString() in ZoneText.

This constructs two temporary strings per task. Cache the label once to reduce overhead and ensure pointer/size always match.

♻️ Proposed refactor
-        ZoneScoped;
-        ZoneText(GetString().c_str(), GetString().size());
+        ZoneScoped;
+        const auto zoneLabel = GetString();
+        ZoneText(zoneLabel.c_str(), zoneLabel.size());

Comment on lines +31 to +52
vcpkg_cmake_configure(
SOURCE_PATH ${SOURCE_PATH}
OPTIONS
-DDOWNLOAD_CAPSTONE=OFF
-DLEGACY=ON
${FEATURE_OPTIONS}
OPTIONS_RELEASE
${TOOLS_OPTIONS}
MAYBE_UNUSED_VARIABLES
DOWNLOAD_CAPSTONE
LEGACY
)
vcpkg_cmake_install()
vcpkg_copy_pdbs()
vcpkg_cmake_config_fixup(PACKAGE_NAME Tracy CONFIG_PATH lib/cmake/Tracy)

function(tracy_copy_tool tool_name tool_dir)
vcpkg_copy_tools(
TOOL_NAMES "${tool_name}"
SEARCH_DIR "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/${tool_dir}"
)
endfunction()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

cat -n cmake/ports/tracy/portfile.cmake

Repository: doodlum/skyrim-community-shaders

Length of output: 2449


🏁 Script executed:

cat -n cmake/ports/tracy/build-tools.patch

Repository: doodlum/skyrim-community-shaders

Length of output: 1362


🏁 Script executed:

# Check if there are other portfiles using VCPKG_BUILD_TYPE for pattern reference
find cmake/ports -name "portfile.cmake" -type f | head -5 | xargs grep -l "VCPKG_BUILD_TYPE" | head -3

Repository: doodlum/skyrim-community-shaders

Length of output: 58


🏁 Script executed:

# Check how vcpkg_copy_tools is used in this repository and nearby portfiles
find cmake/ports -name "portfile.cmake" -type f -exec grep -l "vcpkg_copy_tools" {} \;

Repository: doodlum/skyrim-community-shaders

Length of output: 108


🏁 Script executed:

# Check vcpkg documentation and patterns for build type handling
# Search for any documentation or cmake usage patterns in the repo
find . -name "*.md" -o -name "*.txt" | xargs grep -i "build.type\|debug" 2>/dev/null | head -20

Repository: doodlum/skyrim-community-shaders

Length of output: 766


🌐 Web query:

vcpkg VCPKG_BUILD_TYPE debug build handling portfile

💡 Result:

VCPKG_BUILD_TYPE is a triplet variable that controls whether vcpkg builds both configs (default) or only one config:

  • VCPKG_BUILD_TYPE empty (default): build Release + Debug
  • set(VCPKG_BUILD_TYPE release): build Release only (no Debug build/install) [1]

In a portfile.cmake: handle “debug vs release vs both”

Use VCPKG_BUILD_TYPE to guard any custom steps that would otherwise run twice:

if(VCPKG_BUILD_TYPE STREQUAL "debug")
  # debug-only actions
elseif(VCPKG_BUILD_TYPE STREQUAL "release")
  # release-only actions
else()
  # default: both configs are being built
  # either run actions twice yourself, or do config-agnostic work only
endif()

Prefer config-aware helper functions (recommended)

Most official helpers automatically do “Debug+Release” when VCPKG_BUILD_TYPE is empty, and “Release-only” when it’s set to release. They also let you pass config-specific flags:

CMake ports

Use vcpkg_cmake_configure() with OPTIONS_DEBUG / OPTIONS_RELEASE [2]:

vcpkg_cmake_configure(
  SOURCE_PATH "${SOURCE_PATH}"
  OPTIONS -DSOME_OPT=ON
  OPTIONS_DEBUG   -DDBG_THING=ON
  OPTIONS_RELEASE -DDBG_THING=OFF
)

(CMAKE_BUILD_TYPE is set appropriately per config by the helper.) [2]

Autotools/Make ports

vcpkg_make_configure() documents that steps like PRE_CONFIGURE_CMAKE_COMMANDS run twice when VCPKG_BUILD_TYPE is empty, and only once when it’s release. [3]

Common pitfall: don’t assume Debug folders exist. If the triplet sets VCPKG_BUILD_TYPE=release, ${CURRENT_PACKAGES_DIR}/debug and any “debug install” steps must be skipped/conditional.

Sources: [Triplet variables / VCPKG_BUILD_TYPE] [1], [vcpkg_cmake_configure options + implicit per-config behavior] [2], [vcpkg_make_configure and how VCPKG_BUILD_TYPE changes per-config execution] [3].


Handle debug-only builds for tool options and copy path.

TOOLS_OPTIONS are release-only (placed in OPTIONS_RELEASE) and tracy_copy_tool hardcodes the -rel build directory. When VCPKG_BUILD_TYPE=debug, the tools will not be configured or copied since neither the options nor the directory path exists. Move tool options to OPTIONS (all configs) and check VCPKG_BUILD_TYPE in tracy_copy_tool to select the correct build directory.

Proposed fix
 vcpkg_cmake_configure(
     SOURCE_PATH ${SOURCE_PATH}
     OPTIONS
         -DDOWNLOAD_CAPSTONE=OFF
         -DLEGACY=ON
         ${FEATURE_OPTIONS}
+        ${TOOLS_OPTIONS}
     OPTIONS_RELEASE
-        ${TOOLS_OPTIONS}
     MAYBE_UNUSED_VARIABLES
         DOWNLOAD_CAPSTONE
         LEGACY
 )
@@
 function(tracy_copy_tool tool_name tool_dir)
+    if(VCPKG_BUILD_TYPE STREQUAL "debug")
+        set(_tracy_tool_dir "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/${tool_dir}")
+    else()
+        set(_tracy_tool_dir "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/${tool_dir}")
+    endif()
     vcpkg_copy_tools(
         TOOL_NAMES "${tool_name}"
-        SEARCH_DIR "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/${tool_dir}"
+        SEARCH_DIR "${_tracy_tool_dir}"
     )
 endfunction()
🤖 Prompt for AI Agents
In `@cmake/ports/tracy/portfile.cmake` around lines 31 - 52, The build is missing
tool configuration and copying for debug builds because TOOLS_OPTIONS is only in
OPTIONS_RELEASE and tracy_copy_tool always uses the "-rel" directory; move
${TOOLS_OPTIONS} from the OPTIONS_RELEASE block into the OPTIONS block of the
vcpkg_cmake_configure call so tool-related CMake options are applied for all
build types, and update the tracy_copy_tool function to inspect VCPKG_BUILD_TYPE
(or default to release) and choose the proper search directory suffix (e.g.,
"-rel" for release, "-dbg" or "-debug" for debug) when building SEARCH_DIR from
${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}<suffix>/${tool_dir}.

Comment thread src/Feature.h
Comment on lines +4 to +6
#ifdef TRACY_ENABLE
# include <Tracy/Tracy.hpp>
#endif
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

cat -n src/Feature.h | head -30

Repository: doodlum/skyrim-community-shaders

Length of output: 1242


🏁 Script executed:

wc -l src/Feature.h

Repository: doodlum/skyrim-community-shaders

Length of output: 93


🏁 Script executed:

sed -n '190,200p' src/Feature.h

Repository: doodlum/skyrim-community-shaders

Length of output: 376


🏁 Script executed:

grep -n "std::format\|ForEachLoadedFeature" src/Feature.h

Repository: doodlum/skyrim-community-shaders

Length of output: 438


🏁 Script executed:

cat -n src/FeatureVersions.h

Repository: doodlum/skyrim-community-shaders

Length of output: 129


🏁 Script executed:

fd FeatureVersions.h

Repository: doodlum/skyrim-community-shaders

Length of output: 102


🏁 Script executed:

grep -r "#include.*FeatureVersions.h" --include="*.h" --include="*.hpp"

Repository: doodlum/skyrim-community-shaders

Length of output: 118


🏁 Script executed:

cat -n cmake/FeatureVersions.h.in

Repository: doodlum/skyrim-community-shaders

Length of output: 357


🏁 Script executed:

grep -n "include" src/Feature.h | head -20

Repository: doodlum/skyrim-community-shaders

Length of output: 136


🏁 Script executed:

fd -i "pch\|stdafx\|precompiled" --extension h --extension hpp --extension cmake

Repository: doodlum/skyrim-community-shaders

Length of output: 58


🏁 Script executed:

grep -r "pch\|precompiled" CMakeLists.txt --ignore-case

Repository: doodlum/skyrim-community-shaders

Length of output: 58


🏁 Script executed:

grep -r "std::format\|#include <format>" --include="*.h" --include="*.hpp" --include="*.cpp"

Repository: doodlum/skyrim-community-shaders

Length of output: 25616


🏁 Script executed:

head -20 src/Feature.cpp

Repository: doodlum/skyrim-community-shaders

Length of output: 737


🏁 Script executed:

head -20 src/FeatureIssues.cpp

Repository: doodlum/skyrim-community-shaders

Length of output: 590


🏁 Script executed:

head -30 src/FeatureIssues.h

Repository: doodlum/skyrim-community-shaders

Length of output: 1247


🏁 Script executed:

head -50 src/Globals.h

Repository: doodlum/skyrim-community-shaders

Length of output: 984


🏁 Script executed:

grep -n "#include" src/Globals.h | head -30

Repository: doodlum/skyrim-community-shaders

Length of output: 58


🏁 Script executed:

grep -rn "#include.*<format>" --include="*.h" --include="*.hpp" | head -20

Repository: doodlum/skyrim-community-shaders

Length of output: 58


🏁 Script executed:

cat -n src/Globals.h

Repository: doodlum/skyrim-community-shaders

Length of output: 10318


🏁 Script executed:

sed -n '180,204p' src/Feature.h

Repository: doodlum/skyrim-community-shaders

Length of output: 911


Add <format> include for std::format (header self-containment).

Feature::ForEachLoadedFeature at line 195 uses std::format, but this header doesn't include <format>. If a translation unit includes Feature.h without a precompiled header that already provides <format>, compilation will fail.

Proposed fix
 `#include` "FeatureVersions.h"
+#include <format>
 `#ifdef` TRACY_ENABLE
 #	include <Tracy/Tracy.hpp>
 `#endif`
🤖 Prompt for AI Agents
In `@src/Feature.h` around lines 4 - 6, Feature.h is not self-contained because
Feature::ForEachLoadedFeature uses std::format but the header doesn't include
<format>; add an `#include` <format> to Feature.h (near other includes or after
Tracy include guard) so the declaration/inline use of ForEachLoadedFeature
compiles in translation units that don't already include <format>.

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