Skip to content

Commit

Permalink
updated shdc-bin
Browse files Browse the repository at this point in the history
  • Loading branch information
kassane committed Sep 24, 2024
1 parent e0e0596 commit 610bc74
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
8 changes: 5 additions & 3 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ pub fn build(b: *Build) !void {
b.getInstallStep().dependOn(&ldc.step);
}
}
buildShaders(b);
buildShaders(b, target);

// build tests
// fixme: not building on Windows libsokol w/ kind test (missing cc [??])
Expand Down Expand Up @@ -684,7 +684,7 @@ pub fn buildZigCC(b: *Build) *CompileStep {
}

// a separate step to compile shaders, expects the shader compiler in ../sokol-tools-bin/
fn buildShaders(b: *Build) void {
fn buildShaders(b: *Build, target: Build.ResolvedTarget) void {
const shdc_dep = b.dependency("shdc", .{}).path("").getPath(b);

const sokol_tools_bin_dir = b.pathJoin(&.{ shdc_dep, "bin" });
Expand Down Expand Up @@ -714,6 +714,8 @@ fn buildShaders(b: *Build) void {
}
const shdc_path = b.findProgram(&.{"sokol-shdc"}, &.{}) catch b.pathJoin(&.{ sokol_tools_bin_dir, optional_shdc.? });
const shdc_step = b.step("shaders", "Compile shaders (needs ../sokol-tools-bin)");
const glsl = if (target.result.isDarwin()) "glsl410" else "glsl430";
const slang = glsl ++ ":metal_macos:hlsl5:glsl300es:wgsl";
inline for (shaders) |shader| {
const cmd = b.addSystemCommand(&.{
shdc_path,
Expand All @@ -722,7 +724,7 @@ fn buildShaders(b: *Build) void {
"-o",
shaders_dir ++ shader[0 .. shader.len - 5] ++ ".d",
"-l",
"glsl430:metal_macos:hlsl4:glsl300es:wgsl",
slang,
"-f",
"sokol_d",
});
Expand Down
4 changes: 2 additions & 2 deletions build.zig.zon
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
.hash = "12208a21e4a62ced46244c44c6215ff99c03c0d384ec3afea04b32c4b8ecb1baa41a",
},
.shdc = .{
.url = "git+https://github.com/floooh/sokol-tools-bin#c28c168552817738639cb3b81484bbd88b723388",
.hash = "1220c6f628a11f7fe4d865a92c88290393c06ea352c3ed88b833580346a4bed59972",
.url = "git+https://github.com/floooh/sokol-tools-bin#0732ba3f61dcfd0d0988f4c351421d84ec8b67e4",
.hash = "1220169ae64fd1a357d9dbefc476d3b2f1c9f68ebf979fc56b5947bb0ddba9cceaae",
},
},
}

0 comments on commit 610bc74

Please sign in to comment.