-
Notifications
You must be signed in to change notification settings - Fork 102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add the ability to use Tracy plots directly from Lua via UnsyncedCtrl Spring.LuaTracyPlotConfig and Spring.LuaTracyPlot #1215
Draft
Beherith
wants to merge
11
commits into
master
Choose a base branch
from
LuaTracyPlot
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
4e8d028
Allow for Tracy Plots from Lua, new UnsyncedCtrl callouts: LuaTracyPl…
Beherith f68a46f
Add function ldocs to LuaTracyPlotConfig and LuaTracyPlot
Beherith 53d8152
Further Clarify LuaTracyPlotConfig ldoc strings
Beherith 1a693b0
TracyPlotConfig and TracyPlot now take plotName strings as first argu…
Beherith f46f7d1
Add a comment.
sprunk 05b3b55
Clarify docs for LuaTracyPlots
Beherith 437f13d
Expose LuaTracyPlot to LuaMenu and LuaIntro contexts
Beherith 8145022
Fix whitespace, clarify docstrings
Beherith a2817f2
Microoptimize tracy plot API
sprunk cb4614d
Fix compilation.
sprunk 6d5b246
Commentate the tracy plot storage
sprunk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've realized one more thing, if we want to maintain (And I think we want) that tracing annotations are 0 overhead in release build, those exports should be in
#if defined(TRACY_ENABLE)
blockThe problem is that
tracy::LuaRemove
calls we have to drop tracing in the release mode, won't deleteSpring.LuaTracyPlot
calls, so we might need to add our own cleanup like the code in tracy to do that...There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Relatedly, maybe these should go under the
tracy
namespace in Lua?I've seen that the tracy cleanup is actually just a dumb removal of
tracy.Blabla
from the Lua plaintext code which I expect would break if people didlocal tBla = tracy.Bla
and then usedtBla()
. And withSpring.Bla
there is a heavy cargo cult of localizing functions.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting, what if we just added
Spring.LuaTracyPlot
to the tracy subtable if tracy is present in system.lua?So in usage, Spring.LuaTracyPlot would instead be
tracy.LuaTracyPlot()
Would the tracy cleanup stuff also remove this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes (it would require a one-liner change in the cleanup func to handle the new var but that's trivial)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So no, because we don't own cleanup function code, it lives in the tracy repo.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My preferred solution would still be to have just the bodies of
Spring.TracyLuaPlot
functions gated within#if defined(TRACY_ENABLE)
blocks, effectively making them near noop's.These plotting functions shouldn't be overused too much anyway, so while 100% free is not possible with them, its only a tiny overhead. There are way more egregious wastes of performance littered everywhere else by game developers compared to some empty function calls that provide highly valuable debugging insight when used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But none of those were upstreamed, i.e. we never sent patches to the official repos. We just had a patched internal copy of each of those, and that modified copy then got merge conflicts. The idea here would be to add a new Recoil-side function that wraps over tracy's replacer (without touching tracy itself, so no conflicts) and then actually send patches to the tracy repo (which we never did with the earlier libs).
We can add to it from outside the tracy lib. Consider
rts/Lua/LuaMathExtra.cpp
which adds to the built-in Luamath.
namespace, completely separate fromlib/lua/src/lmathlib.cpp
which is what creates the built-inmath.
namespace. Similarly thetracy.
Lua namespace can be created and mostly filled inside the tracy lib somewhere inlib/tracy/blabla
, and then we would haverts/Lua/LuaTracyExtra.cpp
which adds the others.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 to what Sprung said
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I can write a PoC of my ideal solution on the weekend
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here is my PoC implementation: #1651
@p2004a @Beherith