Skip to content

Commit

Permalink
Update deps + disable tons of SDL shit
Browse files Browse the repository at this point in the history
  • Loading branch information
Beyley committed Oct 6, 2023
1 parent 7155a4f commit 4068f3f
Show file tree
Hide file tree
Showing 5 changed files with 122 additions and 106 deletions.
4 changes: 4 additions & 0 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ pub fn build(b: *std.Build) !void {
.optimize = optimize,
.osx_sdk_path = @as([]const u8, root_path ++ "libs/system-sdk/macos12"),
.linux_sdk_path = @as([]const u8, root_path ++ "libs/system-sdk/linux"),
.disable_audio = true,
.disable_render = true,
.disable_joystick = true,
.disable_video_sub_implementations = true,
});
const sdl_lib = sdl_pkg.artifact("SDL2");

Expand Down
4 changes: 2 additions & 2 deletions build.zig.zon
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
.version = "0.0.0",
.dependencies = .{
.SDL2 = .{
.url = "https://github.com/Beyley/SDL/archive/21bbcba09ce9b489038544b0558980c4ecdf2208.tar.gz",
.hash = "1220848f2f8227ada2676d4778806df242dc828e416519d6fa842bd11520a6876dc8",
.url = "https://github.com/Beyley/SDL/archive/30495aafe9672aebb71b2cf1656c69e03e4eb2cf.tar.gz",
.hash = "12204cbba9cf99a0dfb1f1af987baa25a9f842922ffc0903dc1ce41c7a313913a3e4",
},
.zigimg = .{
.url = "https://github.com/zigimg/zigimg/archive/814064a8935dceee99adb11f2b17871b84f75a2b.tar.gz",
Expand Down
2 changes: 1 addition & 1 deletion libs/zmath/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ pub fn build(b: *std.Build) void {
const optimize = b.standardOptimizeOption(.{});
const target = b.standardTargetOptions(.{});
zmath_pkg = zmath.package(b, target, optimize, .{
const zmath_pkg = zmath.package(b, target, optimize, .{
.options = .{ .enable_cross_platform_determinism = true },
});
Expand Down
34 changes: 17 additions & 17 deletions libs/zmath/src/benchmark.zig
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ noinline fn mat4MulBenchmark(allocator: std.mem.Allocator, comptime count: compt
}
}
const end = timer.read();
const elapsed_s = @floatFromInt(f64, end - start) / time.ns_per_s;
const elapsed_s = @as(f64, @floatFromInt(end - start)) / time.ns_per_s;

std.debug.print("scalar version: {d:.4}s, ", .{elapsed_s});
}
Expand All @@ -158,7 +158,7 @@ noinline fn mat4MulBenchmark(allocator: std.mem.Allocator, comptime count: compt
}
}
const end = timer.read();
const elapsed_s = @floatFromInt(f64, end - start) / time.ns_per_s;
const elapsed_s = @as(f64, @floatFromInt(end - start)) / time.ns_per_s;

std.debug.print("zmath version: {d:.4}s\n", .{elapsed_s});
}
Expand Down Expand Up @@ -208,7 +208,7 @@ noinline fn cross3ScaleBiasBenchmark(allocator: std.mem.Allocator, comptime coun
}
}
const end = timer.read();
const elapsed_s = @floatFromInt(f64, end - start) / time.ns_per_s;
const elapsed_s = @as(f64, @floatFromInt(end - start)) / time.ns_per_s;

std.debug.print("scalar version: {d:.4}s, ", .{elapsed_s});
}
Expand All @@ -228,7 +228,7 @@ noinline fn cross3ScaleBiasBenchmark(allocator: std.mem.Allocator, comptime coun
}
}
const end = timer.read();
const elapsed_s = @floatFromInt(f64, end - start) / time.ns_per_s;
const elapsed_s = @as(f64, @floatFromInt(end - start)) / time.ns_per_s;

std.debug.print("zmath version: {d:.4}s\n", .{elapsed_s});
}
Expand Down Expand Up @@ -279,7 +279,7 @@ noinline fn cross3Dot3ScaleBiasBenchmark(allocator: std.mem.Allocator, comptime
}
}
const end = timer.read();
const elapsed_s = @floatFromInt(f64, end - start) / time.ns_per_s;
const elapsed_s = @as(f64, @floatFromInt(end - start)) / time.ns_per_s;

std.debug.print("scalar version: {d:.4}s, ", .{elapsed_s});
}
Expand All @@ -299,7 +299,7 @@ noinline fn cross3Dot3ScaleBiasBenchmark(allocator: std.mem.Allocator, comptime
}
}
const end = timer.read();
const elapsed_s = @floatFromInt(f64, end - start) / time.ns_per_s;
const elapsed_s = @as(f64, @floatFromInt(end - start)) / time.ns_per_s;

std.debug.print("zmath version: {d:.4}s\n", .{elapsed_s});
}
Expand Down Expand Up @@ -350,7 +350,7 @@ noinline fn quatBenchmark(allocator: std.mem.Allocator, comptime count: comptime
}
}
const end = timer.read();
const elapsed_s = @floatFromInt(f64, end - start) / time.ns_per_s;
const elapsed_s = @as(f64, @floatFromInt(end - start)) / time.ns_per_s;

std.debug.print("scalar version: {d:.4}s, ", .{elapsed_s});
}
Expand All @@ -370,7 +370,7 @@ noinline fn quatBenchmark(allocator: std.mem.Allocator, comptime count: comptime
}
}
const end = timer.read();
const elapsed_s = @floatFromInt(f64, end - start) / time.ns_per_s;
const elapsed_s = @as(f64, @floatFromInt(end - start)) / time.ns_per_s;

std.debug.print("zmath version: {d:.4}s\n", .{elapsed_s});
}
Expand All @@ -393,14 +393,14 @@ noinline fn waveBenchmark(allocator: std.mem.Allocator, comptime count: comptime
while (iter < count) : (iter += 1) {
var z_index: i32 = 0;
while (z_index < grid_size) : (z_index += 1) {
const z = scale * @floatFromInt(f32, z_index - grid_size / 2);
const z = scale * @as(f32, @floatFromInt(z_index - grid_size / 2));

var x_index: i32 = 0;
while (x_index < grid_size) : (x_index += 4) {
const x0 = scale * @floatFromInt(f32, x_index + 0 - grid_size / 2);
const x1 = scale * @floatFromInt(f32, x_index + 1 - grid_size / 2);
const x2 = scale * @floatFromInt(f32, x_index + 2 - grid_size / 2);
const x3 = scale * @floatFromInt(f32, x_index + 3 - grid_size / 2);
const x0 = scale * @as(f32, @floatFromInt(x_index + 0 - grid_size / 2));
const x1 = scale * @as(f32, @floatFromInt(x_index + 1 - grid_size / 2));
const x2 = scale * @as(f32, @floatFromInt(x_index + 2 - grid_size / 2));
const x3 = scale * @as(f32, @floatFromInt(x_index + 3 - grid_size / 2));

const d0 = zm.sqrt(x0 * x0 + z * z);
const d1 = zm.sqrt(x1 * x1 + z * z);
Expand All @@ -421,7 +421,7 @@ noinline fn waveBenchmark(allocator: std.mem.Allocator, comptime count: comptime
t += 0.001;
}
const end = timer.read();
const elapsed_s = @floatFromInt(f64, end - start) / time.ns_per_s;
const elapsed_s = @as(f64, @floatFromInt(end - start)) / time.ns_per_s;

std.debug.print("scalar version: {d:.4}s, ", .{elapsed_s});
}
Expand All @@ -444,12 +444,12 @@ noinline fn waveBenchmark(allocator: std.mem.Allocator, comptime count: comptime
while (iter < count) : (iter += 1) {
var z_index: i32 = 0;
while (z_index < grid_size) : (z_index += 1) {
const z = scale * @floatFromInt(f32, z_index - grid_size / 2);
const z = scale * @as(f32, @floatFromInt(z_index - grid_size / 2));
const vz = zm.splat(T, z);

var x_index: i32 = 0;
while (x_index < grid_size) : (x_index += zm.veclen(T)) {
const x = scale * @floatFromInt(f32, x_index - grid_size / 2);
const x = scale * @as(f32, @floatFromInt(x_index - grid_size / 2));
const vx = zm.splat(T, x) + voffset * zm.splat(T, scale);

const d = zm.sqrt(vx * vx + vz * vz);
Expand All @@ -462,7 +462,7 @@ noinline fn waveBenchmark(allocator: std.mem.Allocator, comptime count: comptime
vt += zm.splat(T, 0.001);
}
const end = timer.read();
const elapsed_s = @floatFromInt(f64, end - start) / time.ns_per_s;
const elapsed_s = @as(f64, @floatFromInt(end - start)) / time.ns_per_s;

std.debug.print("zmath version: {d:.4}s\n", .{elapsed_s});
}
Expand Down
Loading

0 comments on commit 4068f3f

Please sign in to comment.