Skip to main content

new_input_texture_r32float

Function new_input_texture_r32float 

Source
pub fn new_input_texture_r32float(
    ctx: &GpuContext,
    width: u32,
    height: u32,
    data: &[f32],
) -> GpuResult<Texture>
Expand description

Create a sampleable R32Float wgpu::Texture and upload data into it.

The texture is allocated with TEXTURE_BINDING | COPY_DST usage so it can be bound as a texture_2d<f32> in a compute shader and have its contents updated via queue.write_texture.

§Errors

Returns GpuError::ExecutionFailed when data.len() does not equal width × height.