Skip to main content

upload_image

Function upload_image 

Source
pub fn upload_image(
    device: &Device,
    queue: &Queue,
    image: &ImageData,
    filter: ImageFilter,
) -> Result<(TextureView, Sampler), UiError>
Expand description

Upload image to a new Rgba8Unorm GPU texture and create a matching sampler.

Uses queue.write_texture which does NOT require row-alignment padding — bytes_per_row = image.width * 4 is correct here.

§Errors

Returns UiError::Render when the image dimensions are zero.