gpu: update to latest std.mem.span API

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
Stephen Gutekanst 2023-02-08 02:45:30 -07:00 committed by Stephen Gutekanst
parent af1276d9a8
commit f80e02b7c1
2 changed files with 6 additions and 9 deletions

View file

@ -92,14 +92,13 @@ pub const CommandEncoder = opaque {
command_encoder: *CommandEncoder,
buffer: *Buffer,
buffer_offset_bytes: u64,
data_span: anytype,
data_slice: anytype,
) void {
const data_slice = std.mem.span(data_span);
Impl.commandEncoderWriteBuffer(
command_encoder,
buffer,
buffer_offset_bytes,
@ptrCast([*]const u8, data_slice.ptr),
@ptrCast([*]const u8, std.mem.sliceAsBytes(data_slice).ptr),
@intCast(u64, data_slice.len) * @sizeOf(std.meta.Elem(@TypeOf(data_slice))),
);
}

View file

@ -63,14 +63,13 @@ pub const Queue = opaque {
queue: *Queue,
buffer: *Buffer,
buffer_offset_bytes: u64,
data_span: anytype,
data_slice: anytype,
) void {
const data_slice = std.mem.span(data_span);
Impl.queueWriteBuffer(
queue,
buffer,
buffer_offset_bytes,
@ptrCast(*const anyopaque, data_slice.ptr),
@ptrCast(*const anyopaque, std.mem.sliceAsBytes(data_slice).ptr),
data_slice.len * @sizeOf(std.meta.Elem(@TypeOf(data_slice))),
);
}
@ -80,13 +79,12 @@ pub const Queue = opaque {
destination: *const ImageCopyTexture,
data_layout: *const Texture.DataLayout,
write_size: *const Extent3D,
data_span: anytype,
data_slice: anytype,
) void {
const data_slice = std.mem.span(data_span);
Impl.queueWriteTexture(
queue,
destination,
@ptrCast(*const anyopaque, data_slice.ptr),
@ptrCast(*const anyopaque, std.mem.sliceAsBytes(data_slice).ptr),
@intCast(usize, data_slice.len) * @sizeOf(std.meta.Elem(@TypeOf(data_slice))),
data_layout,
write_size,