diff --git a/src/core/platform/glfw/Core.zig b/src/core/platform/glfw/Core.zig index 83d0b7ed..d617344b 100644 --- a/src/core/platform/glfw/Core.zig +++ b/src/core/platform/glfw/Core.zig @@ -137,11 +137,8 @@ pub fn init( input: *Frequency, options: Options, ) !void { - if (!@import("builtin").is_test and !mach.use_sysgpu) _ = mach.wgpu.Export(blk: { - if (@hasDecl(@import("root"), "GPUInterface")) break :blk @import("root").GPUInterface; - break :blk mach.wgpu.dawn.Interface; - }); - if (!@import("builtin").is_test and mach.use_sysgpu) _ = mach.sysgpu.sysgpu.Export(@import("root").SYSGPUInterface); + if (!@import("builtin").is_test and !mach.use_sysgpu) _ = mach.wgpu.Export(mach.wgpu.Impl); + if (!@import("builtin").is_test and mach.use_sysgpu) _ = mach.sysgpu.sysgpu.Export(mach.sysgpu.Impl); const backend_type = try detectBackendType(allocator); diff --git a/src/core/platform/x11/Core.zig b/src/core/platform/x11/Core.zig index b42a0ca5..afff7b55 100644 --- a/src/core/platform/x11/Core.zig +++ b/src/core/platform/x11/Core.zig @@ -300,11 +300,8 @@ pub fn init( input: *Frequency, options: Options, ) !void { - if (!@import("builtin").is_test and !mach.use_sysgpu) _ = mach.wgpu.Export(blk: { - if (@hasDecl(@import("root"), "GPUInterface")) break :blk @import("root").GPUInterface; - break :blk mach.wgpu.dawn.Interface; - }); - if (!@import("builtin").is_test and mach.use_sysgpu) _ = mach.sysgpu.sysgpu.Export(@import("root").SYSGPUInterface); + if (!@import("builtin").is_test and !mach.use_sysgpu) _ = mach.wgpu.Export(mach.wgpu.Impl); + if (!@import("builtin").is_test and mach.use_sysgpu) _ = mach.sysgpu.sysgpu.Export(mach.sysgpu.Impl); const libx11 = try LibX11.load(); const libxcursor: ?LibXCursor = LibXCursor.load() catch |err| switch (err) { diff --git a/src/sysgpu/sysgpu/interface.zig b/src/sysgpu/sysgpu/interface.zig index e32975ae..a3c25484 100644 --- a/src/sysgpu/sysgpu/interface.zig +++ b/src/sysgpu/sysgpu/interface.zig @@ -9,7 +9,10 @@ pub const Impl = blk: { break :blk StubInterface; } else { const root = @import("root"); - if (!@hasDecl(root, "SYSGPUInterface")) @compileError("expected to find `pub const SYSGPUInterface = T;` in root file"); + + // Default to standard implementation of sysgpu.Interface if none was specified. + if (!@hasDecl(root, "SYSGPUInterface")) break :blk Interface(@import("../main.zig").Impl); + _ = sysgpu.Interface(root.SYSGPUInterface); // verify the type break :blk root.SYSGPUInterface; }