emilk/egui · error

Failed to poll device

Error message

Failed to poll device

What it means

Error "Failed to poll device" thrown in emilk/egui.

Source

Thrown at crates/egui_kittest/src/texture_to_image.rs:57

            depth_or_array_layers: 1,
        },
    );

    let submission_index = queue.submit(iter::once(encoder.finish()));

    // Note that we're not calling `.await` here.
    let buffer_slice = output_buffer.slice(..);
    // Sets the buffer up for mapping, sending over the result of the mapping back to us when it is finished.
    let (sender, receiver) = channel();
    buffer_slice.map_async(wgpu::MapMode::Read, move |v| drop(sender.send(v)));

    // Poll the device in a blocking manner so that our future resolves.
    device
        .poll(wgpu::PollType::Wait {
            submission_index: Some(submission_index),
            timeout: Some(WAIT_TIMEOUT),
        })
        .expect("Failed to poll device");

    receiver.recv().unwrap().unwrap();
    let buffer_slice = output_buffer.slice(..);
    let data = buffer_slice
        .get_mapped_range()
        .expect("Failed to get mapped range");
    let data = data
        .chunks_exact(buffer_dimensions.padded_bytes_per_row)
        .flat_map(|row| row.iter().take(buffer_dimensions.unpadded_bytes_per_row))
        .copied()
        .collect::<Vec<_>>();

    RgbaImage::from_raw(texture.width(), texture.height(), data).expect("Failed to create image")
}

struct BufferDimensions {
    height: usize,
    unpadded_bytes_per_row: usize,

View on GitHub (pinned to b9a0723d88)

Solutions

  1. The GPU device was lost while polling: recreate the wgpu device/surface and retry the texture readback.
  2. Check for device loss causes (driver crash, out of memory) before polling.

Example fix

device.poll(wgpu::Maintain::Wait); // after ensuring device not lost via uncaptured error handler

When it happens

Trigger: Thrown at crates/egui_kittest/src/texture_to_image.rs:57 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of emilk/egui@b9a0723d88 (2026-08-19). Data as JSON: /api/errors/025bc774475959b6. Report an issue: GitHub.