diff --git a/gpu/src/dawn_impl.zig b/gpu/src/dawn_impl.zig index 5e7d9535..9b5ec678 100644 --- a/gpu/src/dawn_impl.zig +++ b/gpu/src/dawn_impl.zig @@ -10,10 +10,9 @@ var procs: c.DawnProcTable = undefined; /// A Dawn implementation of the gpu.Interface, which merely directs calls to the Dawn proc table. /// /// Before use, it must be `.init()`ialized in order to set the global proc table. -pub const Interface = gpu.Interface(struct { - pub fn init() @This() { +pub const Interface = struct { + pub fn init() void { procs = c.machDawnGetProcTable(); - return @This(){}; } pub inline fn createInstance(descriptor: ?*const gpu.Instance.Descriptor) ?*gpu.Instance { @@ -1200,7 +1199,7 @@ pub const Interface = gpu.Interface(struct { pub inline fn textureViewRelease(texture_view: *gpu.TextureView) void { procs.textureViewRelease.?(@ptrCast(c.WGPUTextureView, texture_view)); } -}); +}; test "dawn_impl" { _ = gpu.Export(Interface); diff --git a/gpu/src/interface.zig b/gpu/src/interface.zig index 00d2acf2..ee8e6a0e 100644 --- a/gpu/src/interface.zig +++ b/gpu/src/interface.zig @@ -9,8 +9,8 @@ pub const Impl = blk: { break :blk StubInterface; } else { const root = @import("root"); - if (!@hasField(root, "GPUInterface")) @compileError("expected to find `pub const GPUInterface = T;` in root file"); - _ = gpu.Interface(@TypeOf(root.GPUInterface)); // verify the type + if (!@hasDecl(root, "GPUInterface")) @compileError("expected to find `pub const GPUInterface = T;` in root file"); + _ = gpu.Interface(root.GPUInterface); // verify the type break :blk root.GPUInterface; } };