gpu: implement Dawn getProcAddress

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
Stephen Gutekanst 2022-07-30 14:50:18 -07:00 committed by Stephen Gutekanst
parent e702ee4911
commit 48bc09ca93
2 changed files with 6 additions and 5 deletions

View file

@ -21,9 +21,10 @@ pub const Interface = gpu.Interface(struct {
} }
pub inline fn getProcAddress(device: *gpu.Device, proc_name: [*:0]const u8) ?gpu.Proc { pub inline fn getProcAddress(device: *gpu.Device, proc_name: [*:0]const u8) ?gpu.Proc {
_ = device; return procs.getProcAddress.?(
_ = proc_name; @ptrCast(c.WGPUDevice, device),
unreachable; proc_name,
);
} }
pub inline fn adapterCreateDevice(adapter: *gpu.Adapter, descriptor: ?*const gpu.Device.Descriptor) ?*gpu.Device { pub inline fn adapterCreateDevice(adapter: *gpu.Adapter, descriptor: ?*const gpu.Device.Descriptor) ?*gpu.Device {

View file

@ -50,8 +50,8 @@ const device = @import("device.zig");
const interface = @import("interface.zig"); const interface = @import("interface.zig");
/// Generic function pointer type, used for returning API function pointers. Must be /// Generic function pointer type, used for returning API function pointers. Must be
/// cast to a `fn (...) callconv(.C) T` before use. /// cast to the right `fn (...) callconv(.C) T` type before use.
pub const Proc = *anyopaque; pub const Proc = fn () callconv(.C) void;
pub const ComputePassTimestampWrite = extern struct { pub const ComputePassTimestampWrite = extern struct {
query_set: *query_set.QuerySet, query_set: *query_set.QuerySet,