Skip to content

Commit f8dd902

Browse files
committed
[add] texture helpers.
1 parent 58e7dd9 commit f8dd902

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

crates/lambda-rs-platform/src/wgpu/texture.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -640,6 +640,11 @@ impl Texture {
640640
return &self.view;
641641
}
642642

643+
/// Convenience: return a `TextureViewRef` for use in render pass attachments.
644+
pub fn view_ref(&self) -> crate::wgpu::surface::TextureViewRef<'_> {
645+
return crate::wgpu::surface::TextureViewRef { raw: &self.view };
646+
}
647+
643648
/// Optional debug label used during creation.
644649
pub fn label(&self) -> Option<&str> {
645650
return self.label.as_deref();

crates/lambda-rs/src/render/texture.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,13 @@ impl Texture {
349349
pub(crate) fn platform_texture(&self) -> Rc<platform::Texture> {
350350
return self.inner.clone();
351351
}
352+
353+
/// Borrow a texture view reference for use in render pass attachments.
354+
pub(crate) fn view_ref(&self) -> crate::render::surface::TextureView<'_> {
355+
return crate::render::surface::TextureView::from_platform(
356+
self.inner.view_ref(),
357+
);
358+
}
352359
}
353360

354361
#[derive(Debug, Clone)]

0 commit comments

Comments
 (0)