Is there a way to access raw handles for components?
jdu opened this issue · 4 comments
Short info header:
- GFX version: 0.6.0+
- OS: All
- GPU: All
Is there way to expose the raw handle for things like the Device
in order "shim" libraries into gfx-rs?
For example the skulpin project using rafx, can get a raw handle to instance, device, etc.. to pass into skia-safe to bind to a skia BackendContext
. You can see how skulpin does this here https://github.com/aclysma/skulpin/blob/master/skulpin-renderer/src/skia_support.rs#L48 with rafx.
Is there a way to get a passable handle from gfx-rs to perform something similar in order to allow shimming of skia into the gfx-backend-* I've looked through the docs a fair bit and tried a few different things, but i'm coming up empty-handed to see how I could achieve this.
There is no portable way to get the raw handles off gfx-rs objects, since there isn't always 1:1 mapping to anything under the API. Instead, each backend can expose its own raw APIs as needed. For example, Vulkan Instance could make the inner
here public:
gfx/src/backend/vulkan/src/lib.rs
Line 74 in 2ac006f
If you make a list of things you'd need exposed, we can make sure they are available.
I'll have a look at what exactly needs to be made public and see if I can come up with a concrete list based on the different backends. I can do PRs to the individual backends to mark the items public if that's easier than dumping a list here and you can approve/reject depending on whether it aligns with the project.
The PRs are definitely preferred and much appreciated. Thank you!
I'm also interested in this. Personally I would use this to connect gfx-hal with OpenXR, OpenVR (driver API) and FFmpeg hardware acceleration API. Integrating these APIs directly into gfx-hal would not make much sense to me.