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, command_encoder: *CommandEncoder,
buffer: *Buffer, buffer: *Buffer,
buffer_offset_bytes: u64, buffer_offset_bytes: u64,
data_span: anytype, data_slice: anytype,
) void { ) void {
const data_slice = std.mem.span(data_span);
Impl.commandEncoderWriteBuffer( Impl.commandEncoderWriteBuffer(
command_encoder, command_encoder,
buffer, buffer,
buffer_offset_bytes, 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))), @intCast(u64, data_slice.len) * @sizeOf(std.meta.Elem(@TypeOf(data_slice))),
); );
} }

View file

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