From 35465f0b545b6286e44d151f7cbf6acfa8424adc Mon Sep 17 00:00:00 2001 From: ReversedGravity Date: Thu, 21 Sep 2023 23:28:42 +0100 Subject: [PATCH] Added texture r/w without var() call. --- luisa_compute/src/resource.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/luisa_compute/src/resource.rs b/luisa_compute/src/resource.rs index f8d1166..3aba148 100644 --- a/luisa_compute/src/resource.rs +++ b/luisa_compute/src/resource.rs @@ -1274,6 +1274,12 @@ impl Tex2d { pub fn format(&self) -> PixelFormat { self.handle.format } + pub fn read(&self, uv: impl Into>) -> Expr { + self.var().read(uv) + } + pub fn write(&self, uv: impl Into>, v: impl Into>) { + self.var().write(uv, v) + } } impl Tex3d { pub fn view(&self, level: u32) -> Tex3dView { @@ -1294,6 +1300,12 @@ impl Tex3d { pub fn format(&self) -> PixelFormat { self.handle.format } + pub fn read(&self, uv: impl Into>) -> Expr { + self.var().read(uv) + } + pub fn write(&self, uv: impl Into>, v: impl Into>) { + self.var().write(uv, v) + } } #[derive(Clone)] pub struct BufferVar {