gpu: make CommandEncoder.writeBuffer use a slice helper
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
parent
64b67f1b8a
commit
1848ac8ac7
2 changed files with 16 additions and 3 deletions
|
|
@ -152,6 +152,7 @@ Some WebGPU APIs expose slices as pointers and lengths, we either wrap these to
|
||||||
The slice helpers are:
|
The slice helpers are:
|
||||||
|
|
||||||
* `Adapter.enumerateFeaturesOwned`
|
* `Adapter.enumerateFeaturesOwned`
|
||||||
|
* `CommandEncoder.writeBuffer`
|
||||||
* `Queue.writeTexture`
|
* `Queue.writeTexture`
|
||||||
* `Queue.writeBuffer`
|
* `Queue.writeBuffer`
|
||||||
|
|
||||||
|
|
@ -217,7 +218,6 @@ The following are definitive candidates for helpers we haven't implemented yet:
|
||||||
|
|
||||||
* `gpu.Buffer.getConstMappedRange` (slices)
|
* `gpu.Buffer.getConstMappedRange` (slices)
|
||||||
* `gpu.Buffer.getMappedRange` (slices)
|
* `gpu.Buffer.getMappedRange` (slices)
|
||||||
* `gpu.CommandEncoder.writeBuffer` (slices)
|
|
||||||
* `gpu.ComputePassEncoder.setBindGroup` (slice param)
|
* `gpu.ComputePassEncoder.setBindGroup` (slice param)
|
||||||
* `gpu.Device.enumerateFeatures` (owned slice)
|
* `gpu.Device.enumerateFeatures` (owned slice)
|
||||||
* `gpu.RenderBundleEncoder.setBindGroup` (slice param)
|
* `gpu.RenderBundleEncoder.setBindGroup` (slice param)
|
||||||
|
|
|
||||||
|
|
@ -81,8 +81,21 @@ pub const CommandEncoder = opaque {
|
||||||
Impl.commandEncoderSetLabel(command_encoder, label);
|
Impl.commandEncoderSetLabel(command_encoder, label);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub inline fn writeBuffer(command_encoder: *CommandEncoder, buffer: *Buffer, buffer_offset: u64, data: [*]const u8, size: u64) void {
|
pub inline fn writeBuffer(
|
||||||
Impl.commandEncoderWriteBuffer(command_encoder, buffer, buffer_offset, data, size);
|
command_encoder: *CommandEncoder,
|
||||||
|
buffer: *Buffer,
|
||||||
|
buffer_offset_bytes: u64,
|
||||||
|
data_slice: anytype,
|
||||||
|
) void {
|
||||||
|
Impl.commandEncoderWriteBuffer(
|
||||||
|
command_encoder,
|
||||||
|
buffer,
|
||||||
|
buffer_offset_bytes,
|
||||||
|
data,
|
||||||
|
size,
|
||||||
|
@ptrCast([*]const u8, data_slice.ptr),
|
||||||
|
@intCast(u64, data_slice.len) * @sizeOf(std.meta.Elem(@TypeOf(data_slice))),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub inline fn writeTimestamp(command_encoder: *CommandEncoder, query_set: *QuerySet, query_index: u32) void {
|
pub inline fn writeTimestamp(command_encoder: *CommandEncoder, query_set: *QuerySet, query_index: u32) void {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue