pub struct VulkanRenderContext<'a> {
pub device: &'a Device,
pub queue: Queue,
pub queue_family_index: u32,
pub command_pool: CommandPool,
pub memory_properties: Option<&'a PhysicalDeviceMemoryProperties>,
}Expand description
Borrowed Vulkan objects supplied by the host runtime.
The renderer never creates a session or owns the presented images. The host is responsible for frame lifecycle and passes the active Vulkan device/queue objects here.
§Examples
use ailloli_ui_render_vulkan::VulkanRenderContext;
use ash::vk;
fn borrow_host<'a>(
device: &'a ash::Device,
queue: vk::Queue,
family: u32,
pool: vk::CommandPool,
) -> VulkanRenderContext<'a> {
VulkanRenderContext::new(device, queue, family, pool)
}Fields§
§device: &'a DeviceLogical device used to create and destroy renderer-owned resources.
queue: QueueHost queue used for renderer submissions.
queue_family_index: u32Index of the family owning Self::queue.
command_pool: CommandPoolHost command pool used for transient frame command buffers.
memory_properties: Option<&'a PhysicalDeviceMemoryProperties>Physical-device memory types; required by rendering paths that allocate resources.
Implementations§
Source§impl<'a> VulkanRenderContext<'a>
Constructors for borrowed host contexts.
impl<'a> VulkanRenderContext<'a>
Constructors for borrowed host contexts.
Sourcepub fn new(
device: &'a Device,
queue: Queue,
queue_family_index: u32,
command_pool: CommandPool,
) -> Self
pub fn new( device: &'a Device, queue: Queue, queue_family_index: u32, command_pool: CommandPool, ) -> Self
Borrows device/queue objects without memory properties.
This form is suitable only until a path needs buffer or image allocation;
VulkanRenderer::new then returns
VulkanRendererError::MissingMemoryProperties.
§Examples
use ailloli_ui_render_vulkan::VulkanRenderContext;
use ash::vk;
fn make<'a>(device: &'a ash::Device, queue: vk::Queue, pool: vk::CommandPool) {
let context = VulkanRenderContext::new(device, queue, 2, pool);
assert_eq!(context.queue_family_index, 2);
assert!(context.memory_properties.is_none());
}Sourcepub fn with_memory_properties(
device: &'a Device,
queue: Queue,
queue_family_index: u32,
command_pool: CommandPool,
memory_properties: &'a PhysicalDeviceMemoryProperties,
) -> Self
pub fn with_memory_properties( device: &'a Device, queue: Queue, queue_family_index: u32, command_pool: CommandPool, memory_properties: &'a PhysicalDeviceMemoryProperties, ) -> Self
Borrows device/queue objects and physical-device memory properties.
§Examples
use ailloli_ui_render_vulkan::VulkanRenderContext;
use ash::vk;
fn make<'a>(
device: &'a ash::Device,
queue: vk::Queue,
pool: vk::CommandPool,
memory: &'a vk::PhysicalDeviceMemoryProperties,
) {
let context = VulkanRenderContext::with_memory_properties(device, queue, 2, pool, memory);
assert!(context.memory_properties.is_some());
}