pub struct Texture { /* private fields */ }Expand description
A texture on the GPU, loaded from a QOI file through nadir-assets.
It is made by Asset::finalize, which needs the Device in the
FinalizeCtx. A QOI file marked sRGB becomes an
TextureFormat::Rgba8Srgb texture, and one marked linear an
TextureFormat::Rgba8. Once its scopes are unloaded,
Asset::release destroys it on the device, which then refuses its id.
Implementations§
Trait Implementations§
Source§impl Asset for Texture
impl Asset for Texture
Source§fn placeholder(ctx: &mut FinalizeCtx<'_>) -> Result<Self, AssetError>
fn placeholder(ctx: &mut FinalizeCtx<'_>) -> Result<Self, AssetError>
An 8×8 checker of magenta and black texels.
Source§fn release(self, ctx: &mut FinalizeCtx<'_>) -> Result<(), AssetError>
fn release(self, ctx: &mut FinalizeCtx<'_>) -> Result<(), AssetError>
Destroys the texture on the Device in the context.
Source§const EXTENSIONS: &'static [&'static str]
const EXTENSIONS: &'static [&'static str]
The extensions, without the dot, that a path of this type ends in.
Source§type Decoded = DecodedTexture
type Decoded = DecodedTexture
What
Asset::decode makes.Source§fn decode(
bytes: &[u8],
ctx: &DecodeCtx<'_>,
) -> Result<DecodedTexture, AssetError>
fn decode( bytes: &[u8], ctx: &DecodeCtx<'_>, ) -> Result<DecodedTexture, AssetError>
Decodes a file’s bytes. Read more
Source§fn finalize(
decoded: DecodedTexture,
ctx: &mut FinalizeCtx<'_>,
) -> Result<Self, AssetError>
fn finalize( decoded: DecodedTexture, ctx: &mut FinalizeCtx<'_>, ) -> Result<Self, AssetError>
Makes the asset from what
Asset::decode made. Read moreimpl Copy for Texture
impl Eq for Texture
impl StructuralPartialEq for Texture
Auto Trait Implementations§
impl Forget for Texture
impl Freeze for Texture
impl Move for Texture
impl RefUnwindSafe for Texture
impl Send for Texture
impl Sync for Texture
impl Unpin for Texture
impl UnsafeUnpin for Texture
impl UnwindSafe for Texture
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more