Skip to content

Commit

Permalink
Updated kernel args match
Browse files Browse the repository at this point in the history
  • Loading branch information
ulises-jeremias committed Feb 23, 2023
1 parent 4dc518a commit 7079aaa
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 0 deletions.
5 changes: 5 additions & 0 deletions vcl/bytes.c.v
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,8 @@ pub fn (b &Bytes) data() ?[]u8 {
pub fn (b &Bytes) map(mut k Kernel) chan IError {
return k.global(b.buf.size).local(1).run(b)
}

// buffer returns the underlying buffer
pub fn (b &Bytes) buffer() &Buffer {
return b.buf
}
5 changes: 5 additions & 0 deletions vcl/image.c.v
Original file line number Diff line number Diff line change
Expand Up @@ -193,3 +193,8 @@ fn (d &Device) create_image_general(image_type ImageChannelOrder, bounds Rect, r
desc: desc
}
}

// buffer returns the underlying buffer
fn (image &Image) buffer() &Buffer {
return image.buf
}
3 changes: 3 additions & 0 deletions vcl/kernel.c.v
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,9 @@ fn (k &Kernel) set_arg(index int, arg ArgumentType) ? {
u64 {
return k.set_arg_unsafe(index, int(sizeof(arg)), unsafe { &arg })
}
Buffer {
return k.set_arg_buffer(index, arg)
}
Bytes {
return k.set_arg_buffer(index, arg.buf)
}
Expand Down
5 changes: 5 additions & 0 deletions vcl/vector.c.v
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,8 @@ pub fn (v &Vector[T]) data() ?[]T {
pub fn (v &Vector[T]) map(k &Kernel) chan IError {
return k.global(v.length()).local(1).run(v)
}

// buffer returns the underlying buffer
pub fn (v &Vector[T]) buffer() &Buffer {
return v.buf
}

0 comments on commit 7079aaa

Please sign in to comment.