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

@ -28,8 +28,8 @@
.hash = "1220db6845ce34743ae2a1ab0222efc942496adde2736c20e3443d4fde4ef64b11b9", .hash = "1220db6845ce34743ae2a1ab0222efc942496adde2736c20e3443d4fde4ef64b11b9",
}, },
.mach_gpu = .{ .mach_gpu = .{
.url = "https://pkg.machengine.org/mach-gpu/f60434e10a9e8d0b6dc5419960267188c960f5ec.tar.gz", .url = "https://pkg.machengine.org/mach-gpu/528dad0823dafeae5d474c88cc658b091bf2e605.tar.gz",
.hash = "122058c8775820ff0b1f6feb7373364abe1182f5f72ca4d0830d13d861c08a246179", .hash = "1220fe2e555ca66741539bc0f97769b2513c5e609c968d27eb8997f577a1d195f048",
}, },
.mach_glfw = .{ .mach_glfw = .{
.url = "https://pkg.machengine.org/mach-glfw/26e8af73d7d4fbdac3ff60492c44294fc0d139b7.tar.gz", .url = "https://pkg.machengine.org/mach-glfw/26e8af73d7d4fbdac3ff60492c44294fc0d139b7.tar.gz",

View file

@ -9,8 +9,6 @@ pub const modules = .{
Game, Game,
}; };
pub const GPUInterface = mach.core.wgpu.dawn.Interface;
pub fn main() !void { pub fn main() !void {
// Initialize mach.Core // Initialize mach.Core
try mach.core.initModule(); try mach.core.initModule();

View file

@ -11,8 +11,6 @@ pub const modules = .{
Game, Game,
}; };
pub const GPUInterface = mach.core.wgpu.dawn.Interface;
// TODO: move this to a mach "entrypoint" zig module // TODO: move this to a mach "entrypoint" zig module
pub fn main() !void { pub fn main() !void {
// Initialize mach core // Initialize mach core

View file

@ -136,7 +136,10 @@ pub fn init(
input: *Frequency, input: *Frequency,
options: Options, options: Options,
) !void { ) !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); 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); const backend_type = try detectBackendType(allocator);

View file

@ -299,7 +299,10 @@ pub fn init(
input: *Frequency, input: *Frequency,
options: Options, options: Options,
) !void { ) !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); if (!@import("builtin").is_test and mach_core.options.use_sysgpu) _ = mach_core.sysgpu.sysgpu.Export(@import("root").SYSGPUInterface);
const libx11 = try LibX11.load(); const libx11 = try LibX11.load();