wolfpld / tracy

Frame profiler
https://tracy.nereid.pl/
Other
8.64k stars 595 forks source link

Add support to set color when creating a ScopedZone #755

Closed Chekov2k closed 3 months ago

Chekov2k commented 3 months ago

This pull request adds the option to specify the colour of a scoped zone for the c-api as well as for the coming Python API.

As requested, this has been split out from Pull Request 754.

I hope adding a default colour parameter to tracy::Profiler::AllocSourceLocation is okay as well as using constructor delegation for the ScopedZone.

wolfpld commented 3 months ago

Where are these new constructors used or how are they exposed?

Chekov2k commented 3 months ago

Where are these new constructors used or how are they exposed?

Apologies, I just realised that I apparently did not force push to update my Pull-Request correctly :-( I also added some more explanation below.

The main use for me is in the PyScopedZone used to create the Python-bindings:

fZone = new tracy::ScopedZone(fLine, fFile.c_str(), fFunction.c_str(), fName.c_str(), fName.size(), fColor, true);

The other changes are to expose them in the C-API as requested by simonvanbernem in Pull-Request 754, i.e. in ___tracy_alloc_srcloc and ___tracy_alloc_srcloc_name

Chekov2k commented 3 months ago

Had to add a static_cast<uint32_t>(0) so the ScopedZone constructor is delegating to the right one ...