gpu: add gpu.NativeInstance.fromWGPUAdapter

For when you have a native adapter and need a wrapped one.

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
Stephen Gutekanst 2022-03-31 16:51:16 +00:00
parent 354df53523
commit 1f076da7bf

View file

@ -213,7 +213,11 @@ const surface_vtable = Surface.VTable{
}).release,
};
fn wrapAdapter(adapter: c.WGPUAdapter) Adapter {
pub inline fn fromWGPUAdapter(adapter: *anyopaque) Adapter {
return wrapAdapter(@ptrCast(c.WGPUAdapter, adapter));
}
pub fn wrapAdapter(adapter: c.WGPUAdapter) Adapter {
var c_props: c.WGPUAdapterProperties = undefined;
c.wgpuAdapterGetProperties(adapter, &c_props);
const properties = Adapter.Properties{