-
Notifications
You must be signed in to change notification settings - Fork 953
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
[Metal] Add a way to create a device and queue from raw resources in wgpu-hal #3338
Conversation
Codecov Report
@@ Coverage Diff @@
## master #3338 +/- ##
==========================================
+ Coverage 64.10% 64.51% +0.41%
==========================================
Files 86 86
Lines 42591 42597 +6
==========================================
+ Hits 27301 27480 +179
+ Misses 15290 15117 -173
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good enough for now - we need to go through and audit all of these external interface functions later anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whoops, wrong button
hmm, something went wrong here, I think I messed up the branches, give me a moment |
Head branch was pushed to by a user without write access
Fixed, sorry about that. This change should only add |
Checklist
cargo clippy
.RUSTFLAGS=--cfg=web_sys_unstable_apis cargo clippy --target wasm32-unknown-unknown
if applicable.Connections
Related to #3145 and #2320
Description
This PR adds
device_from_raw
andqueue_from_raw
in addition to the existingtexture_from_raw
. This allows to get theMTLDevice
and/orMTLCommandQueue
from external application, and use them to process external memory/texture in wgpu.My use case involves OpenFX plugin for DaVinci Resolve video editor, and Resolve provides MTLTexture and MTLCommandQueue pointers, which I then use in a plugin written in Rust and wgpu.
With these 2 new functions, one can create
wgpu::Device
andwgpu::Queue
from a raw pointer toMTLCommandQueue
the following way:Testing
I tested these changes with pointers provided by the DaVinci Resolve, and also with pointers provided from Qt and QML renderer, both cases work as intended.