Skip to content

Commit

Permalink
metal: create view from external MTLTexture
Browse files Browse the repository at this point in the history
  • Loading branch information
kvark committed Feb 12, 2024
1 parent 0dd584a commit ebfbe51
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions blade-graphics/src/metal/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,12 @@ impl TextureView {
fn as_ref(&self) -> &metal::TextureRef {
unsafe { metal::TextureRef::from_ptr(self.raw) }
}

/// Create a TextureView from a raw Metal Texture.
/// Does not keep a reference, need not being destoryed.
pub fn from_external(&self, raw: &metal::TextureRef) -> Self {
Self { raw: raw.as_ptr() }
}
}

#[derive(Clone, Copy, Debug, Hash, PartialEq)]
Expand Down

0 comments on commit ebfbe51

Please sign in to comment.