imgui-wgpu

March 19, 2026 ยท View on GitHub

GitHub Workflow Status Documentation Crates.io License

A wgpu render backend for dear imgui (imgui-rs).

screenshot

Getting Started

Add imgui-wgpu to your Cargo.toml:

[dependencies]
imgui-wgpu = "0.28"
imgui = "0.12"
wgpu = "29"

Usage

Create a Renderer during setup, then call render() each frame inside a wgpu render pass:

// Setup
let mut imgui = imgui::Context::create();
let renderer_config = imgui_wgpu::RendererConfig {
    texture_format: surface_format, // must match your surface
    ..imgui_wgpu::RendererConfig::new()
};
let mut renderer = imgui_wgpu::Renderer::new(&mut imgui, &device, &queue, renderer_config);

// Per frame
let draw_data = imgui_context.render();
let mut rpass = encoder.begin_render_pass(/* ... */);
renderer.render(draw_data, &queue, &device, &mut rpass).unwrap();

For more control over GPU buffer lifetime, use prepare() + split_render() instead of render().

Color Space

RendererConfig::new() (the default) outputs linear color for sRGB framebuffers (Bgra8UnormSrgb). Use RendererConfig::new_srgb() if rendering to a linear framebuffer (Bgra8Unorm).

Custom Textures

let texture = imgui_wgpu::Texture::new(&device, &renderer, TextureConfig {
    size: wgpu::Extent3d { width: 64, height: 64, depth_or_array_layers: 1 },
    ..Default::default()
});
texture.write(&queue, &pixel_data, 64, 64);
let tex_id = renderer.textures.insert(texture);
// Use tex_id with imgui::Image

Examples

cargo run --release --example hello-world
cargo run --release --example custom-texture
cargo run --release --example cube
ExampleDescription
hello-worldBasic imgui window with winit integration
custom-textureLoading and displaying a custom image
cube3D rendering with an imgui overlay
emptyMinimal test for empty draw lists

Version Compatibility

imgui-wgpuwgpuimgui
master290.12
0.28.0290.12
0.27.0280.12
0.26.0270.12
0.25.0250.12
0.24.00.170.11
0.23.00.160.11
0.22.00.150.10
0.21.00.140.9
0.20.00.130.8
0.19.00.120.8
0.18.00.110.8
0.17.00.100.8
0.16.00.90.7
0.15.00.80.7
0.14.00.70.7
0.13.00.70.6
0.12.00.60.6
0.11.00.60.5
0.10.00.60.5
0.9.00.60.4
0.8.00.50.4
0.7.00.50.4
0.6.00.50.3
0.5.00.40.3
0.4.00.40.2
0.1.00.30.2

Minimum Supported Rust Version (MSRV)

The MSRV of this crate is 1.87. MSRV bumps are considered breaking changes.

Contributing

Contributions are welcome! Please open an issue or pull request on GitHub.

License

Licensed under either of Apache License, Version 2.0 or MIT License at your option.