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

Is there a way to access raw handles for components? #3698

Open
jdu opened this issue Mar 25, 2021 · 4 comments
Open

Is there a way to access raw handles for components? #3698

jdu opened this issue Mar 25, 2021 · 4 comments

Comments

@jdu
Copy link

jdu commented Mar 25, 2021

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.

@kvark
Copy link
Member

kvark commented Mar 25, 2021

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:

inner: ash::Instance,

If you make a list of things you'd need exposed, we can make sure they are available.

@jdu
Copy link
Author

jdu commented Mar 25, 2021

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.

@kvark
Copy link
Member

kvark commented Mar 25, 2021

The PRs are definitely preferred and much appreciated. Thank you!

@zarik5
Copy link
Contributor

zarik5 commented May 15, 2021

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.

bors bot added a commit that referenced this issue May 20, 2021
3762: Low level interop with Vulkan backend r=kvark a=zarik5

Related issues: #3698 #3761 blaind/xrbevy#1

This PR exposes some Vulkan-backend-specific details needed for interop with other low level APIs. In particular this PR aims to implement a minimum viable API to allow OpenXR integration as a separate crate.

This PR is nowhere complete. I opened it to get some feedback; this is my first PR on a project the size of gfx-hal.

This is the first of multiple PRs needed for OpenXR support in wgpu.

PR checklist:
- [ ] `make` succeeds (on *nix)
- [ ] `make reftests` succeeds
- [ ] tested examples with the following backends: Vulkan

EDIT: To make things clear, this is another take on #3761. Me and @blaind are working together on this route.

Co-authored-by: zarik5 <riccardo.zaglia5@gmail.com>
bors bot added a commit that referenced this issue Jun 17, 2021
3775: expose the underlying metal device r=kvark a=ccbrown

This facilitates the ability to lock and utilize the underlying Metal device directly.

My need is very similar to the one described in #3698, in which it was mentioned that functionality like this could be added to the individual backends and that PRs were appreciated.

PR checklist:
- [x] `make` succeeds (on *nix)
- [x] `make reftests` succeeds
- [x] tested examples with the following backends:


Co-authored-by: Chris Brown <ccbrown112@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants