core: provide a default sysgpu interface implementation

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
Stephen Gutekanst 2024-04-29 11:57:54 -07:00 committed by Stephen Gutekanst
parent fc0ff2fffd
commit 44f950a7f3
3 changed files with 8 additions and 11 deletions

View file

@ -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);

View file

@ -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) {