From 1f076da7bfa43aa3bb0033508819ac23547a898f Mon Sep 17 00:00:00 2001 From: Stephen Gutekanst Date: Thu, 31 Mar 2022 16:51:16 +0000 Subject: [PATCH] gpu: add gpu.NativeInstance.fromWGPUAdapter For when you have a native adapter and need a wrapped one. Signed-off-by: Stephen Gutekanst --- gpu/src/NativeInstance.zig | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gpu/src/NativeInstance.zig b/gpu/src/NativeInstance.zig index db1a7c9e..62acc7d8 100644 --- a/gpu/src/NativeInstance.zig +++ b/gpu/src/NativeInstance.zig @@ -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{