core: provide a default pub const GPUInterface

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
Stephen Gutekanst 2024-04-09 21:20:48 -07:00
parent 3583e1754f
commit d1c3d26710
5 changed files with 10 additions and 8 deletions

View file

@ -136,7 +136,10 @@ pub fn init(
input: *Frequency,
options: Options,
) !void {
if (!@import("builtin").is_test and mach_core.options.use_wgpu) _ = mach_core.wgpu.Export(@import("root").GPUInterface);
if (!@import("builtin").is_test and mach_core.options.use_wgpu) _ = mach_core.wgpu.Export(blk: {
if (@hasDecl(@import("root"), "GPUInterface")) break :blk @import("root").GPUInterface;
break :blk mach_core.wgpu.dawn.Interface;
});
if (!@import("builtin").is_test and mach_core.options.use_sysgpu) _ = mach_core.sysgpu.sysgpu.Export(@import("root").SYSGPUInterface);
const backend_type = try detectBackendType(allocator);

View file

@ -299,7 +299,10 @@ pub fn init(
input: *Frequency,
options: Options,
) !void {
if (!@import("builtin").is_test and mach_core.options.use_wgpu) _ = mach_core.wgpu.Export(@import("root").GPUInterface);
if (!@import("builtin").is_test and mach_core.options.use_wgpu) _ = mach_core.wgpu.Export(blk: {
if (@hasDecl(@import("root"), "GPUInterface")) break :blk @import("root").GPUInterface;
break :blk mach_core.wgpu.dawn.Interface;
});
if (!@import("builtin").is_test and mach_core.options.use_sysgpu) _ = mach_core.sysgpu.sysgpu.Export(@import("root").SYSGPUInterface);
const libx11 = try LibX11.load();