Skip to content

Commit 40d2ba3

Browse files
committed
make copy_to_buffer takes &BufferVar<T> so that you can pass &Buffer<T> as full view
1 parent 3f7898f commit 40d2ba3

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

luisa_compute/src/resource.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ pub struct Buffer<T: Value> {
286286
impl<T: Value> BufferView<T> {
287287
pub fn copy_async<'a>(&self, s: &'a Scope<'a>) -> Buffer<T> {
288288
let copy = self.device.create_buffer(self.len);
289-
s.submit([self.copy_to_buffer_async(copy.view(..))]);
289+
s.submit([self.copy_to_buffer_async(&copy)]);
290290
copy
291291
}
292292
pub fn copy(&self) -> Buffer<T> {
@@ -443,7 +443,7 @@ impl<T: Value> BufferView<T> {
443443
pub fn fill(&self, value: T) {
444444
self.fill_fn(|_| value);
445445
}
446-
pub fn copy_to_buffer_async(&self, dst: BufferView<T>) -> Command<'static, 'static> {
446+
pub fn copy_to_buffer_async(&self, dst: &BufferView<T>) -> Command<'static, 'static> {
447447
assert_eq!(self.len, dst.len);
448448
let mut rt = ResourceTracker::new();
449449
rt.add(self._handle());
@@ -461,7 +461,7 @@ impl<T: Value> BufferView<T> {
461461
callback: None,
462462
}
463463
}
464-
pub fn copy_to_buffer(&self, dst: BufferView<T>) {
464+
pub fn copy_to_buffer(&self, dst: &BufferView<T>) {
465465
submit_default_stream_and_sync(&self.device, [self.copy_to_buffer_async(dst)]);
466466
}
467467
pub fn view<S: RangeBounds<usize>>(&self, range: S) -> BufferView<T> {

0 commit comments

Comments
 (0)