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

GPU: Integrating Profilers #11452

Open
namandixit opened this issue Nov 12, 2024 · 1 comment
Open

GPU: Integrating Profilers #11452

namandixit opened this issue Nov 12, 2024 · 1 comment

Comments

@namandixit
Copy link
Contributor

namandixit commented Nov 12, 2024

There needs to be some supported method to allow integration of instrumentation profilers in the rendering code when using SDL_GPU.

At the very least, this would require exposing handles/pointers/objects from the back-end APIs themselves which is currently treated as an internal detail (#10876).

For example, integrating Tracy requires:
  1. Direct3D 12: ID3D12Device*, ID3D12CommandQueue*, ID3D12GraphicsCommandList*
  2. Vulkan: VkPhysicalDevice, VkInstance, VkPhysicalDevice, VkDevice, VkQueue, VkCommandBuffer
  3. Metal: MTLDevice, MTLComputePassDescriptor*, MTLBlitPassDescriptor*, MTLRenderPassDescriptor*, MTLComputeCommandEncoder

However, just exposing the handles may not be enough, since it is possible that the source code location where the calls to the profiler library are supposed to be made might be within the SDL library itself. That is to say, it is possible that by the time the user gets control, it might be too late to make the appropriate call.

If that is the case, we would need to be able to set some callbacks that are called in some well defined places within the library. It might also be possible to expose this using the Event system if the callback-based SDL_AppEvent is being used; so that at some well defined points within SDL_GPU , the corresponding event is added to the event queue and SDL_AppEvent is called before moving forward with the respective operation.

And the nuclear option might be to simply add an API to expose the various counters, etc. through SDL_GPU system itself, thus allowing us to write our own profilers.

@namandixit
Copy link
Contributor Author

namandixit commented Nov 12, 2024

Listing common GPU instrumentation profilers here for reference: Tracy, Remotery, Microprofile, maybe Superluminal?

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

1 participant