pub struct Builder<'a> { /* private fields */ }Expand description
Builds a Vulkan BackendContext with optional extensions and protected mode.
Implementations§
Source§impl<'a> BackendContextBuilder<'a>
impl<'a> BackendContextBuilder<'a>
Sourcepub fn new(
instance: Instance,
physical_device: PhysicalDevice,
device: Device,
(queue, queue_index): (Queue, usize),
get_proc: &'a impl GetProc,
max_api_version: impl Into<Option<Version>>,
) -> Self
pub fn new( instance: Instance, physical_device: PhysicalDevice, device: Device, (queue, queue_index): (Queue, usize), get_proc: &'a impl GetProc, max_api_version: impl Into<Option<Version>>, ) -> Self
Creates a new builder for a Vulkan backend context.
The max_api_version is applied during native context creation, before
the Vulkan memory allocator is initialized.
If a version is provided, it should match the value provided in
VkApplicationInfo::apiVersion when creating the VkInstance. Pass None to leave Skia’s
VulkanBackendContext::fMaxAPIVersion at its default 0; Skia then queries
vkEnumerateInstanceVersion() and uses that loader-reported version as the upper limit when
validating Vulkan entry points and creating the memory allocator.
Skia requires Vulkan 1.1 as the minimum supported API version.
Sourcepub fn with_extensions(
self,
instance_extensions: &[&str],
device_extensions: &[&str],
) -> Self
pub fn with_extensions( self, instance_extensions: &[&str], device_extensions: &[&str], ) -> Self
Sets the Vulkan instance and device extension names expected by Skia.
The provided names are copied into the builder.
Sourcepub fn with_protected_context(self, protected_context: Protected) -> Self
pub fn with_protected_context(self, protected_context: Protected) -> Self
Configures whether the context should operate in protected mode.
Sourcepub unsafe fn build(self) -> BackendContext<'a>
pub unsafe fn build(self) -> BackendContext<'a>
Creates the Vulkan BackendContext from the configured builder state.
If Self::with_protected_context() is not called, protected mode defaults to
gpu::Protected::No.
§Safety
instance, physical_device, device, and queue must outlive the BackendContext
returned.