Skip to content

Add support for Tracy profiler#65793

Open
dvdkon wants to merge 9 commits intoqgis:masterfrom
dvdkon:tracy
Open

Add support for Tracy profiler#65793
dvdkon wants to merge 9 commits intoqgis:masterfrom
dvdkon:tracy

Conversation

@dvdkon
Copy link
Copy Markdown
Contributor

@dvdkon dvdkon commented Apr 13, 2026

Description

Tracy is a popular debugging tool for (not only) 3D applications that combines sampled stacktraces with manually added information in a single interface. QGIS already has support for generating traces in Chromium trace event format via QgsEventTracing, but Tracy is more capable, which should help us both find performance issues and debug intermittent 3D issues.

This PR adds support for embedding a Tracy client inside QGIS, gated behind a CMake option WITH_TRACY. I've re-used the existing QgsEventTracing interface to forward any zones to Tracy, added new methods to send variables to be plotted, and also forwarded log messages, 3D frame begin events and thumbnails of rendered frames.

Since I expect only some developers will use this integration, the build system currently expects Tracy to be already installed as a system package. Another option is to install Tracy via vcpkg.

tracy

AI tool usage

  • AI tool(s) (Copilot, Claude, or something similar) supported my development of this PR. See our policy about AI tool use. Use of AI tools must be indicated. Failure to be honest might result in banning.

@github-actions github-actions Bot added this to the 4.2.0 milestone Apr 13, 2026
@github-actions github-actions Bot added Build/Install Related to compiling or installing QGIS 3D Relates to QGIS' 3D engine or rendering labels Apr 13, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 13, 2026

🧮 Vcpkg update report

🍎 MacOS Qt6 builds

Download MacOS Qt6 builds of this PR for testing.
This app is not notarized, run sudo xattr -d com.apple.quarantine /Applications/QGIS*.app to avoid the warning
(Built from commit d027dc2)

Comment on lines +268 to +271
// Separate thumbnail capture pass to save scaled-down images of the
// rendered view to aid in debugging (e.g., Tracy profiler frame images).
Qt3DRender::QRenderCapture *mThumbnailCapture = nullptr;
Qt3DRender::QTexture2D *mThumbnailTexture = nullptr;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

these should be gated by #ifdef HAVE_TRACY -- otherwise they may trigger unused member warnings.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The code that uses these is not gated behind `HAVE_TRACY``, only the call to initialise that part of the frame graph is, so no warnings should be triggered.

I could surround all the new code by ifdefs, but I think it's better like this, to make sure the code doesn't atrophy.

Comment thread src/app/main.cpp Outdated
Comment thread src/core/qgseventtracing.cpp Outdated
Comment thread src/core/qgseventtracing.cpp Outdated
@dvdkon dvdkon force-pushed the tracy branch 2 times, most recently from 2596dec to 3d426b6 Compare April 16, 2026 20:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3D Relates to QGIS' 3D engine or rendering Build/Install Related to compiling or installing QGIS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants