Update callback example to use takeDelimiterInclusive for Zig 0.15.2 delimiter behavior change.

This commit is contained in:
Foke Singh 2025-12-12 14:00:50 +00:00
parent 7e81d022ff
commit 1b8d0ac627

View File

@ -82,11 +82,7 @@ pub const GrayScale = struct {
} }
pub fn grayScaleCuda(self: GrayScale, rgb_d: zml.Buffer, gray_d: zml.Buffer) !void { pub fn grayScaleCuda(self: GrayScale, rgb_d: zml.Buffer, gray_d: zml.Buffer) !void {
var args: [2][]u8 = .{ var args: [2:null]?*anyopaque = .{ rgb_d.devicePtr(), gray_d.devicePtr() };
@as([*]u8, @ptrFromInt(rgb_d.devicePtr()))[0..rgb_d.shape().byteSize()],
@as([*]u8, @ptrFromInt(gray_d.devicePtr()))[0..gray_d.shape().byteSize()],
};
var args_ptr: [2:null]?*anyopaque = .{ @ptrCast(&args[0]), @ptrCast(&args[1]) };
// This is a naive kernel with one block per pixel. // This is a naive kernel with one block per pixel.
try cuda.check(cuda.launchKernel.?( try cuda.check(cuda.launchKernel.?(
@ptrCast(self.cu_data[1]), // function @ptrCast(self.cu_data[1]), // function
@ -98,7 +94,7 @@ pub const GrayScale = struct {
1, // num grids z 1, // num grids z
0, // shared mem 0, // shared mem
@ptrCast(self.stream), @ptrCast(self.stream),
&args_ptr, &args,
null, null,
)); ));
// Note: no explicit synchronization, we just enqueue work in the stream. // Note: no explicit synchronization, we just enqueue work in the stream.