pub struct DeviceBuilder<'a> { /* private fields */ }Expand description
Allows to easily create an erupt::DeviceLoader and queues.
Implementations§
Source§impl<'a> DeviceBuilder<'a>
impl<'a> DeviceBuilder<'a>
Sourcepub fn with_loader_builder(loader_builder: DeviceLoaderBuilder<'a>) -> Self
pub fn with_loader_builder(loader_builder: DeviceLoaderBuilder<'a>) -> Self
Create a new device builder with a custom DeviceLoaderBuilder.
Sourcepub fn custom_queue_setup(
self,
custom_queue_setup: Box<CustomQueueSetupFn>,
) -> Self
pub fn custom_queue_setup( self, custom_queue_setup: Box<CustomQueueSetupFn>, ) -> Self
Specify a custom queue setup.
§Default setup
|physical_device, queue_family_criteria, queue_family_properties| {
let mut queue_setup = HashSet::with_capacity(queue_family_criteria.len());
for queue_family_criteria in queue_family_criteria {
match queue_family_criteria.choose_queue_family(
instance,
physical_device,
queue_family_properties,
surface,
)? {
Some((idx, _properties)) => {
queue_setup.insert(QueueSetup::simple(idx, 1));
}
None => return Ok(None),
}
}
Ok(Some(queue_setup))
}Sourcepub fn additional_suitability(
self,
additional_suitability: Box<AdditionalSuitabilityFn>,
) -> Self
pub fn additional_suitability( self, additional_suitability: Box<AdditionalSuitabilityFn>, ) -> Self
Allows to specify custom criteria for a physical device. This can for example be used to check for limits.
Sourcepub fn for_surface(self, surface: SurfaceKHR) -> Self
pub fn for_surface(self, surface: SurfaceKHR) -> Self
Surface to use to check for presentation support in queue families.
Sourcepub fn prioritise_device_types(self, types: &[PhysicalDeviceType]) -> Self
pub fn prioritise_device_types(self, types: &[PhysicalDeviceType]) -> Self
Prioritise devices of these types when choosing a device. The further ahead, the higher the priority.
Sourcepub fn queue_family(self, criteria: QueueFamilyCriteria) -> Self
pub fn queue_family(self, criteria: QueueFamilyCriteria) -> Self
The queue family chosen by the criteria will be enabled on the device.
Sourcepub fn prefer_device_memory_size(self, size: DeviceSize) -> Self
pub fn prefer_device_memory_size(self, size: DeviceSize) -> Self
Prefer a device which has at least one DEVICE_LOCAL memory heap with
a minimum of size bytes of memory.
Sourcepub fn require_device_memory_size(self, size: DeviceSize) -> Self
pub fn require_device_memory_size(self, size: DeviceSize) -> Self
Require a device which has at least one DEVICE_LOCAL memory heap with
a minimum of size bytes of memory.
Sourcepub fn prefer_extension(self, extension: *const c_char) -> Self
pub fn prefer_extension(self, extension: *const c_char) -> Self
Prefer a device which supports extension.
The extension will only be enabled if it’s supported.
Sourcepub fn require_extension(self, extension: *const c_char) -> Self
pub fn require_extension(self, extension: *const c_char) -> Self
Require a device which supports extension.
The extension will be enabled.
Sourcepub fn prefer_version(self, major: u32, minor: u32) -> Self
pub fn prefer_version(self, major: u32, minor: u32) -> Self
Prefer a device which supports this version.
Sourcepub fn prefer_version_raw(self, version: u32) -> Self
pub fn prefer_version_raw(self, version: u32) -> Self
Prefer a device which supports this version.
Sourcepub fn require_version(self, major: u32, minor: u32) -> Self
pub fn require_version(self, major: u32, minor: u32) -> Self
Require the device to support this version.
Sourcepub fn require_version_raw(self, version: u32) -> Self
pub fn require_version_raw(self, version: u32) -> Self
Require the device to support this version.
Sourcepub fn require_features(self, features: &'a PhysicalDeviceFeatures2) -> Self
pub fn require_features(self, features: &'a PhysicalDeviceFeatures2) -> Self
Require these features to be present for the device. The elements of the pointer chain will only be considered if possible. The features will be enabled.
Sourcepub fn select_nth_unconditionally(self, n: usize) -> Self
pub fn select_nth_unconditionally(self, n: usize) -> Self
Skip the selection logic and always select the physical device at the specified index.
Sourcepub fn allocation_callbacks(self, allocator: AllocationCallbacks) -> Self
pub fn allocation_callbacks(self, allocator: AllocationCallbacks) -> Self
Allocation callback to use for internal Vulkan calls in the builder.
Sourcepub unsafe fn build(
self,
instance: &'a InstanceLoader,
instance_metadata: &InstanceMetadata,
) -> Result<(DeviceLoader, DeviceMetadata), DeviceCreationError>
pub unsafe fn build( self, instance: &'a InstanceLoader, instance_metadata: &InstanceMetadata, ) -> Result<(DeviceLoader, DeviceMetadata), DeviceCreationError>
Returns the erupt::DeviceLoader and DeviceMetadata, containing
the handle of the used physical device handle and its properties, as
wells as the enabled device extensions and used queue setups.