Skip to main content

texture_from_file

Function texture_from_file 

Source
pub fn texture_from_file(path: impl AsRef<Path>) -> Result<Texture>
Expand description

Decode a still-image file directly into a packed RGBA8 Texture.

This host codec boundary uploads the decoded pixels once, without converting through normalized planar FP32 Image storage or reading device pixels back. Donor composition: oa/ui/viewer.cpp::openImage, FnImage::decodeFile and FnTexture::fromImage; adapted to Rust’s device-resident Image distinction.

§Errors

Returns an error for inaccessible, unsupported or malformed media, or failed checked texture allocation/upload.

This variant uploads on this thread’s default runtime. An runtime initialization failure is returned before decoding starts.