Skip to content
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

Enabling bgfx profiling #2

Closed
vrimar opened this issue Jan 28, 2025 · 6 comments
Closed

Enabling bgfx profiling #2

vrimar opened this issue Jan 28, 2025 · 6 comments

Comments

@vrimar
Copy link

vrimar commented Jan 28, 2025

ProfilerBegin / ProfilerEnd in Callbacks.cs are never called. Am I missing some debug flag?

@clibequilibrium
Copy link
Owner

ProfilerBegin / ProfilerEnd in Callbacks.cs are never called. Am I missing some debug flag?

Could you elaborate more? You can handle it in DefaultCallbackHandler.cs

@vrimar
Copy link
Author

vrimar commented Jan 28, 2025

If I set a breakpoint in DefaultCallbackHandler.ProfilerBegin it never triggers when running in debug mode via vscode. If I understand correctly, bgfx invokes ProfilerBegin/End which I'm trying to integrate with Tracy to profile.

@clibequilibrium
Copy link
Owner

If I set a breakpoint in DefaultCallbackHandler.ProfilerBegin it never triggers when running in debug mode via vscode. If I understand correctly, bgfx invokes ProfilerBegin/End which I'm trying to integrate with Tracy to profile.

No? you have to invoke them yourself https://bkaradzic.github.io/bgfx/bgfx.html#_CPPv4N4bgfx9CallbackI13profilerBeginEPKc8uint32_tPKc8uint16_t

@vrimar
Copy link
Author

vrimar commented Jan 28, 2025

Based on the following:

bgfx::renderer_d3d11.h
bgfx::bgfx_p.h

bgfx invokes the g_callback->profileBegin/End callbacks so you can hook into it to profile with something like Tracy. Now I'm wondering if you need to build bgfx with a specific flag to get it working.

EDIT: Setting the BGFX_CONFIG_PROFILER=1 flag in debug bgfx build enables it. Apologies for the noise.

@vrimar vrimar closed this as completed Jan 28, 2025
@clibequilibrium
Copy link
Owner

Based on the following:

bgfx::renderer_d3d11.h bgfx::bgfx_p.h

bgfx invokes the g_callback->profileBegin/End callbacks so you can hook into it to profile with something like Tracy. Now I'm wondering if you need to build bgfx with a specific flag to get it working.

EDIT: Setting the BGFX_CONFIG_PROFILER=1 flag in debug bgfx build enables it. Apologies for the noise.

Thanks for finding the root issue. I might need to add the disclaimer to the README that precompiled binary of bgfx doesn't have the flag set.

@vrimar
Copy link
Author

vrimar commented Jan 29, 2025

Sounds good, thanks for all your hard work!

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

No branches or pull requests

2 participants