From f80e02b7c10c8c27498d79d6fc13386ded8b6524 Mon Sep 17 00:00:00 2001 From: Stephen Gutekanst Date: Wed, 8 Feb 2023 02:45:30 -0700 Subject: [PATCH] gpu: update to latest std.mem.span API Signed-off-by: Stephen Gutekanst --- libs/gpu/src/command_encoder.zig | 5 ++--- libs/gpu/src/queue.zig | 10 ++++------ 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/libs/gpu/src/command_encoder.zig b/libs/gpu/src/command_encoder.zig index fe8e2555..b4bc7f42 100644 --- a/libs/gpu/src/command_encoder.zig +++ b/libs/gpu/src/command_encoder.zig @@ -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))), ); } diff --git a/libs/gpu/src/queue.zig b/libs/gpu/src/queue.zig index 7c9981fd..49d2f4f2 100644 --- a/libs/gpu/src/queue.zig +++ b/libs/gpu/src/queue.zig @@ -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,