gpu: fix requestAdapter implementation
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
parent
3a0b0fd83c
commit
60702eb9e6
2 changed files with 2 additions and 14 deletions
|
|
@ -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" {
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue