gfx-rs / gfx

[maintenance mode] A low-overhead Vulkan-like GPU API for Rust.
http://gfx-rs.github.io/
Apache License 2.0
5.35k stars 551 forks source link

[vk]: implement Device::start_capture() and Device::stop_capture() on Vulkan using renderdoc (as optional feature/dependency) #3737

Closed manuel-woelker closed 3 years ago

manuel-woelker commented 3 years ago

TODOs:

This is a follow up on #3708

Fixes #issue PR checklist:

manuel-woelker commented 3 years ago

Implementing this for the other backends (DX11, DX12, GL) should be fairly similar.

Any preferences on having one PR per backend, or all in one?

kvark commented 3 years ago

All in one is fine, but let's first figure out the proper way to do this on one backend.

manuel-woelker commented 3 years ago

Next iteration, using renderdoc-sys and some pointer wrangling. RenderDoc still seems to be happy :-)

manuel-woelker commented 3 years ago
  1. Any thoughts on how to handle this in the example code? There is currently a crude solution that allows starting and stopping a frame capture using "S" and "E"respectively. Any recommended approach?

  2. If the plan is to encapsulate and reuse this functionality in other backends, where would the best place to put it be? gfx-hal?

Thanks for the review and advice, much appreciated!

kvark commented 3 years ago

Any thoughts on how to handle this in the example code? There is currently a crude solution that allows starting and stopping a frame capture using "S" and "E"respectively. Any recommended approach?

I recommend just unconditionally starting the capture in the compute example at start, and finishing it at the end. This would mean you don't need to write any input handling code.

If the plan is to encapsulate and reuse this functionality in other backends, where would the best place to put it be? gfx-hal?

It's already in gfx-hal. The start/stop capture API is on the hal::Device

manuel-woelker commented 3 years ago

Pushed another version, with removed feature flag and some cleanup :-)

manuel-woelker commented 3 years ago

Ready for another review, I cleaned up the match expressions and marked load_renderdoc_entrypoint() unsafe

manuel-woelker commented 3 years ago

I reordered the cfg!(debug_assertions) and cleaned up the brace nesting.

kvark commented 3 years ago

Great! bors r+

bors[bot] commented 3 years ago

Build succeeded:

manuel-woelker commented 3 years ago

👍 Thanks for the through review @kvark, and shoutout to @adamnemecek for pointing me this way 😃

kvark commented 3 years ago

Thank you for tirelessly addressing my concerns! I'm excited to finally remove all renderdoc-specific code from downstream crates :)

adamnemecek commented 3 years ago

@manuel-woelker This is all you.