Skip to content

Commit

Permalink
build: fix sysgpu_backend build option (#1264)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tatskaari authored Sep 8, 2024
1 parent 51bf4f4 commit 0a04a3c
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions src/sysgpu/main.zig
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,20 @@ pub const sysgpu = @import("sysgpu/main.zig");
pub const shader = @import("shader.zig");
const utils = @import("utils.zig");

const backend_type: sysgpu.BackendType =
if (build_options.sysgpu_backend != .default) build_options.sysgpu_backend else switch (builtin.target.os.tag) {
.linux => .vulkan,
.macos, .ios => .metal,
.windows => .d3d12,
else => @compileError("unsupported platform"),
const backend_type: sysgpu.BackendType = switch (build_options.sysgpu_backend) {
.webgpu => .webgpu,
.d3d12 => .d3d12,
.metal => .metal,
.vulkan => .vulkan,
.opengl => .opengl,
.default => switch (builtin.target.os.tag) {
.linux => .vulkan,
.macos, .ios => .metal,
.windows => .d3d12,
else => @compileError("unsupported platform"),
},
};

const impl = switch (backend_type) {
.d3d12 => @import("d3d12.zig"),
.metal => @import("metal.zig"),
Expand Down

0 comments on commit 0a04a3c

Please sign in to comment.