Skip to content

Commit

Permalink
make copy_to_buffer takes &BufferVar<T> so that you can pass &Buffer<…
Browse files Browse the repository at this point in the history
…T> as full view
  • Loading branch information
shiinamiyuki committed Nov 14, 2023
1 parent 3f7898f commit 40d2ba3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions luisa_compute/src/resource.rs
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ pub struct Buffer<T: Value> {
impl<T: Value> BufferView<T> {
pub fn copy_async<'a>(&self, s: &'a Scope<'a>) -> Buffer<T> {
let copy = self.device.create_buffer(self.len);
s.submit([self.copy_to_buffer_async(copy.view(..))]);
s.submit([self.copy_to_buffer_async(&copy)]);
copy
}
pub fn copy(&self) -> Buffer<T> {
Expand Down Expand Up @@ -443,7 +443,7 @@ impl<T: Value> BufferView<T> {
pub fn fill(&self, value: T) {
self.fill_fn(|_| value);
}
pub fn copy_to_buffer_async(&self, dst: BufferView<T>) -> Command<'static, 'static> {
pub fn copy_to_buffer_async(&self, dst: &BufferView<T>) -> Command<'static, 'static> {
assert_eq!(self.len, dst.len);
let mut rt = ResourceTracker::new();
rt.add(self._handle());
Expand All @@ -461,7 +461,7 @@ impl<T: Value> BufferView<T> {
callback: None,
}
}
pub fn copy_to_buffer(&self, dst: BufferView<T>) {
pub fn copy_to_buffer(&self, dst: &BufferView<T>) {
submit_default_stream_and_sync(&self.device, [self.copy_to_buffer_async(dst)]);
}
pub fn view<S: RangeBounds<usize>>(&self, range: S) -> BufferView<T> {
Expand Down

0 comments on commit 40d2ba3

Please sign in to comment.