Crate imgui_rs_vulkan_renderer[][src]

Expand description

imgui-rs-vulkan-renderer

A Vulkan renderer for imgui-rs using Ash.

How it works

The renderer records drawing command to a command buffer supplied by the application. Here is a little breakdown of the features of this crate and how they work.

  • Vertex/Index buffers

The renderer creates a vertex buffer and a index buffer that will be updated every time Renderer::cmd_draw is called. If the vertex/index count is more than what the buffers can actually hold then the buffers are resized (actually destroyed then re-created).

  • Frames in flight

The renderer support having multiple frames in flight. You need to specify the number of frames during initialization of the renderer. The renderer manages one vertex and index buffer per frame.

  • No draw call execution

The Renderer::cmd_draw only record commands to a command buffer supplied by the application. It does not submit anything to the gpu.

  • Custom textures

The renderer supports custom textures. See Renderer::textures for details.

  • Custom Vulkan allocators

Custom Vulkan allocators are not supported for the moment.

Integration

You can find an example of integration in the common module of the examples.

The RendererVkContext trait

You need to implement that trait that will be used to access Vulkan resources such as the instance and device.

vk-mem support

The vk-mem-rs is now supported via the vkmem feature.

When enabled you’ll need to implement RendererVkContext::vk_mem_allocator to return a reference to a vk_mem::Allocator. Then call Renderer::with_vk_mem_allocator instead of Renderer::new to create a Renderer.

Examples

You can run a set of examples by running the following command:

export VK_LAYER_PATH=$VULKAN_SDK/Bin
export VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation

./compile_shaders.sh

cargo run --example <example>

Modules

Vulkan helpers.

Structs

Vulkan renderer for imgui.

Enums

Crates error type.

Traits

Trait providing access to the application’s Vulkan context.

Type Definitions

Convenient return type for function that can return a RendererError.