Trait wgpu::util::DeviceExt

source ·
pub trait DeviceExt {
    // Required methods
    fn create_buffer_init(&self, desc: &BufferInitDescriptor<'_>) -> Buffer;
    fn create_texture_with_data(
        queue: &Queue,
        desc: &TextureDescriptor<'_>,
        data: &[u8]
    ) -> Texture;
Expand description

Utility methods not meant to be in the main API.

Required Methods§


fn create_buffer_init(&self, desc: &BufferInitDescriptor<'_>) -> Buffer

Creates a Buffer with data to initialize it.


fn create_texture_with_data( &self, queue: &Queue, desc: &TextureDescriptor<'_>, data: &[u8] ) -> Texture

Upload an entire texture and its mipmaps from a source buffer.

Expects all mipmaps to be tightly packed in the data buffer.

If the texture is a 2DArray texture, uploads each layer in order, expecting each layer and its mips to be tightly packed.

Example: Layer0Mip0 Layer0Mip1 Layer0Mip2 … Layer1Mip0 Layer1Mip1 Layer1Mip2 …

Implicitly adds the COPY_DST usage if it is not present in the descriptor, as it is required to be able to upload the data to the gpu.