diff --git a/gpu/src/Interface.zig b/gpu/src/Interface.zig index d34204b4..3e2ff07e 100644 --- a/gpu/src/Interface.zig +++ b/gpu/src/Interface.zig @@ -36,7 +36,7 @@ pub const RequestAdapterOptions = struct { force_fallback_adapter: bool = false, /// Only respected by native WebGPU implementations. - compatible_surface: ?Surface, + compatible_surface: ?Surface = null, }; pub const RequestAdapterErrorCode = error{ @@ -81,18 +81,6 @@ pub fn requestAdapter(interface: Interface, options: *const RequestAdapterOption const f = @asyncCall(frame_buffer, &result, interface.vtable.requestAdapter, .{ interface.ptr, options }); resume f; return result; - - // @asyncCall(frame_buffer: []align(@alignOf(@Frame(anyAsyncFunction))) u8, result_ptr, function_ptr, args: anytype) anyframe->T - - // var data: i32 = 1; - // const Foo = struct { - // bar: fn (*i32) callconv(.Async) void, - // }; - // var foo = Foo{ .bar = func }; - // var bytes: [64]u8 align(@alignOf(@Frame(func))) = undefined; - // const f = @asyncCall(&bytes, {}, foo.bar, .{&data}); - - // return async interface.vtable.requestAdapter(interface.ptr, options); } test "syntax" { diff --git a/gpu/src/NativeInstance.zig b/gpu/src/NativeInstance.zig index 0aef01f4..9f5399f1 100644 --- a/gpu/src/NativeInstance.zig +++ b/gpu/src/NativeInstance.zig @@ -74,6 +74,7 @@ const interface_vtable = Interface.VTable{ // TODO: Once crbug.com/dawn/1122 is fixed, we should process events here otherwise our // callback will not be invoked. // c.wgpuInstanceProcessEvents(native.instance) + suspend {} // must suspend so that async caller can resume // Return the response, asserting the callback has executed at this point. const resp = native.request_adapter_response.?; @@ -97,7 +98,6 @@ const interface_vtable = Interface.VTable{ /// Returns the gpu.Interface for interacting with this native instance. pub fn interface(native: *NativeInstance) Interface { - std.debug.assert(@alignOf(@Frame(interface_vtable.requestAdapter)) == 16); return .{ .ptr = native, .vtable = &interface_vtable,