build: fix sysgpu_backend build option (#1264)
This commit is contained in:
parent
51bf4f40f2
commit
0a04a3c7c7
1 changed files with 13 additions and 6 deletions
|
|
@ -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"),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue