build: bump tracy to 0.13.1#1761
Conversation
📝 WalkthroughWalkthroughThis 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
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~30 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
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 |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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 doubleGetString()inZoneText.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());
| 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() |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
cat -n cmake/ports/tracy/portfile.cmakeRepository: doodlum/skyrim-community-shaders
Length of output: 2449
🏁 Script executed:
cat -n cmake/ports/tracy/build-tools.patchRepository: 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 -3Repository: 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 -20Repository: 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_TYPEempty (default): build Release + Debugset(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}.
| #ifdef TRACY_ENABLE | ||
| # include <Tracy/Tracy.hpp> | ||
| #endif |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
cat -n src/Feature.h | head -30Repository: doodlum/skyrim-community-shaders
Length of output: 1242
🏁 Script executed:
wc -l src/Feature.hRepository: doodlum/skyrim-community-shaders
Length of output: 93
🏁 Script executed:
sed -n '190,200p' src/Feature.hRepository: doodlum/skyrim-community-shaders
Length of output: 376
🏁 Script executed:
grep -n "std::format\|ForEachLoadedFeature" src/Feature.hRepository: doodlum/skyrim-community-shaders
Length of output: 438
🏁 Script executed:
cat -n src/FeatureVersions.hRepository: doodlum/skyrim-community-shaders
Length of output: 129
🏁 Script executed:
fd FeatureVersions.hRepository: 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.inRepository: doodlum/skyrim-community-shaders
Length of output: 357
🏁 Script executed:
grep -n "include" src/Feature.h | head -20Repository: doodlum/skyrim-community-shaders
Length of output: 136
🏁 Script executed:
fd -i "pch\|stdafx\|precompiled" --extension h --extension hpp --extension cmakeRepository: doodlum/skyrim-community-shaders
Length of output: 58
🏁 Script executed:
grep -r "pch\|precompiled" CMakeLists.txt --ignore-caseRepository: 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.cppRepository: doodlum/skyrim-community-shaders
Length of output: 737
🏁 Script executed:
head -20 src/FeatureIssues.cppRepository: doodlum/skyrim-community-shaders
Length of output: 590
🏁 Script executed:
head -30 src/FeatureIssues.hRepository: doodlum/skyrim-community-shaders
Length of output: 1247
🏁 Script executed:
head -50 src/Globals.hRepository: doodlum/skyrim-community-shaders
Length of output: 984
🏁 Script executed:
grep -n "#include" src/Globals.h | head -30Repository: doodlum/skyrim-community-shaders
Length of output: 58
🏁 Script executed:
grep -rn "#include.*<format>" --include="*.h" --include="*.hpp" | head -20Repository: doodlum/skyrim-community-shaders
Length of output: 58
🏁 Script executed:
cat -n src/Globals.hRepository: doodlum/skyrim-community-shaders
Length of output: 10318
🏁 Script executed:
sed -n '180,204p' src/Feature.hRepository: 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>.
Depends on #1760
Summary by CodeRabbit
New Features
Chores
✏️ Tip: You can customize this high-level summary in your review settings.