Skip to main content

Builder

Struct Builder 

Source
pub struct Builder<'a> { /* private fields */ }
Expand description

Builds a Vulkan BackendContext with optional extensions and protected mode.

Implementations§

Source§

impl<'a> BackendContextBuilder<'a>

Source

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.

Source

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.

Source

pub fn with_protected_context(self, protected_context: Protected) -> Self

Configures whether the context should operate in protected mode.

Source

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.

Trait Implementations§

Source§

impl Debug for BackendContextBuilder<'_>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.