VKU
Work in progress utility crate for kickstarting vulkan development with shaderc, ash and the VMA allocator.
Center module is Vkinit, created from RawHandles and VkInitCreateInfo.
Warning
This is mostly a personal utility crate and no guarentees are made in terms of stability until 1.0.0.
Initialization
use WindowBuilder;
use ;
use LogicalSize;
use ;
use ;
let event_loop: = default.build;
let size = ;
let window = new
.with_inner_size
.build.unwrap;
let display_h = window.raw_display_handle;
let window_h = window.raw_window_handle;
let create_info = default;
let init = new.unwrap;
Swapchain recreation:
# use *;
# use *;
# let event_loop: EventLoop = default.build;
# let size = ;
# let window = new.with_inner_size.build.unwrap;
# let display_h = raw_display_handle;
# let window_h = raw_window_handle;
# let create_info = default;
let mut init = new.unwrap;
let new_size = ;
init.recreate_swapchain.unwrap;
VMA Image allocation and layout transition:
# use *;
# use *;
# let event_loop: EventLoop = default.build;
# let size = ;
# let window = new.with_inner_size.build.unwrap;
# let display_h = raw_display_handle;
# let window_h = raw_window_handle;
# let create_info = default;
let init = new.unwrap;
let setup_cmd_buffer_pool =
init.create_cmd_pool.unwrap;
let setup_cmd_buffer =
init.create_command_buffers.unwrap;
let setup_fence = init.create_fence.unwrap;
init.begin_cmd_buffer.unwrap;
let extent = Extent3D;
let format = R8G8B8A8_UNORM;
let aspect_flags = COLOR;
let mut image = init.create_empty_image.unwrap;
let image_barrier = image.get_image_layout_transition_barrier2.unwrap; // No queue family ownership transfer
init.cmd_pipeline_barrier2; // Only this image barrier, no BufferMemoryBarriers
init.end_and_submit_cmd_buffer.unwrap; // Wait on setup fence, wait/signal no semaphores
Shader compilation with #include directives:
# use Path;
# use VkInit;
let src_dir_path = new;
let target_dir_path = new;
let debug_text_result = true;
compile_all_shaders.unwrap;
More examples
For more examples check the examples folder.