[][src]Struct amethyst_rendy::rendy::factory::Factory

pub struct Factory<B> where
    B: Backend
{ /* fields omitted */ }

Higher level device interface. Manges memory, resources and queue families.

Methods

impl<B> Factory<B> where
    B: Backend
[src]

pub fn wait_idle(&self) -> Result<(), HostExecutionError>[src]

Wait for whole device become idle. This function is very heavy and usually used only for teardown.

pub fn create_relevant_buffer<impl MemoryUsage>(
    &self,
    info: BufferInfo,
    memory_usage: impl MemoryUsage
) -> Result<Buffer<B>, Error> where
    impl MemoryUsage: MemoryUsage
[src]

Creates a buffer with the specified properties.

This function returns relevant value, that is, the value cannot be dropped. However buffer can be destroyed using destroy_relevant_buffer function.

pub unsafe fn destroy_relevant_buffer(&self, buffer: Buffer<B>)[src]

Destroy buffer. If buffer was created using create_buffer it must be unescaped first. If buffer was shaderd unescaping may fail due to other owners existing. In any case unescaping and destroying manually can slightly increase performance.

Safety

Buffer must not be used by any pending commands or referenced anywhere.

pub fn create_buffer<impl MemoryUsage>(
    &self,
    info: BufferInfo,
    memory_usage: impl MemoryUsage
) -> Result<Escape<Buffer<B>>, Error> where
    impl MemoryUsage: MemoryUsage
[src]

Creates a buffer with the specified properties.

This function (unlike create_relevant_buffer) returns value that can be dropped.

pub fn create_relevant_image<impl MemoryUsage>(
    &self,
    info: ImageInfo,
    memory_usage: impl MemoryUsage
) -> Result<Image<B>, Error> where
    impl MemoryUsage: MemoryUsage
[src]

Creates an image with the specified properties.

This function returns relevant value, that is, the value cannot be dropped. However image can be destroyed using destroy_relevant_image function.

pub unsafe fn destroy_relevant_image(&self, image: Image<B>)[src]

Destroy image. If image was created using create_image it must be unescaped first. If image was shaderd unescaping may fail due to other owners existing. In any case unescaping and destroying manually can slightly increase performance.

Safety

Image must not be used by any pending commands or referenced anywhere.

pub fn create_image<impl MemoryUsage>(
    &self,
    info: ImageInfo,
    memory_usage: impl MemoryUsage
) -> Result<Escape<Image<B>>, Error> where
    impl MemoryUsage: MemoryUsage
[src]

Creates an image with the specified properties.

This function (unlike create_relevant_image) returns value that can be dropped.

pub fn image_format_properties(
    &self,
    info: ImageInfo
) -> Option<FormatProperties>
[src]

Fetch image format details for a particular ImageInfo.

pub fn create_relevant_image_view(
    &self,
    image: Handle<Image<B>>,
    info: ImageViewInfo
) -> Result<ImageView<B>, Error>
[src]

Create an image view with the specified properties

This function returns relevant value, that is, the value cannot be dropped. However image view can be destroyed using destroy_relevant_image_view function.

pub unsafe fn destroy_relevant_image_view(&self, view: ImageView<B>)[src]

Destroy image view. If image view was created using create_image_view it must be unescaped first. If image view was shaderd unescaping may fail due to other owners existing. In any case unescaping and destroying manually can slightly increase performance.

Safety

Image view must not be used by any pending commands or referenced anywhere.

pub fn create_image_view(
    &self,
    image: Handle<Image<B>>,
    info: ImageViewInfo
) -> Result<Escape<ImageView<B>>, Error>
[src]

Create an image view with the specified properties

This function (unlike create_relevant_image_view) returns value that can be dropped.

pub fn create_relevant_sampler(
    &self,
    info: SamplerInfo
) -> Result<Sampler<B>, AllocationError>
[src]

Create an sampler with the specified properties

This function returns relevant value, that is, the value cannot be dropped. However sampler can be destroyed using destroy_relevant_sampler function.

pub unsafe fn destroy_relevant_sampler(&self, sampler: Sampler<B>)[src]

Destroy sampler. If sampler was created using create_sampler it must be unescaped first. If sampler was shaderd unescaping may fail due to other owners existing. In any case unescaping and destroying manually can slightly increase performance. If sampler was acquired using get_sampler unescaping will most probably fail due to factory holding handler's copy in cache.

Safety

Sampler view must not be used by any pending commands or referenced anywhere.

pub fn create_sampler(
    &self,
    info: SamplerInfo
) -> Result<Escape<Sampler<B>>, AllocationError>
[src]

Creates a sampler with the specified properties.

This function (unlike create_relevant_sampler) returns value that can be dropped.

pub fn get_sampler(
    &self,
    info: SamplerInfo
) -> Result<Handle<Sampler<B>>, AllocationError>
[src]

Get cached sampler or create new one. User should prefer this function to create_sampler and create_relevant_sampler because usually only few sampler configuration is required.

pub unsafe fn upload_visible_buffer<T>(
    &self,
    buffer: &mut Buffer<B>,
    offset: u64,
    content: &[T]
) -> Result<(), Error>
[src]

Update content of the buffer bound to host visible memory. This function (unlike upload_buffer) update content immediatelly.

Buffers allocated from host-invisible memory types cannot be updated via this function.

Updated content will be automatically made visible to device operations that will be submitted later.

Panics

Panics if buffer size is less than offset + size of content.

Safety

Caller must ensure that device doesn't use memory region that being updated.

pub unsafe fn upload_buffer<T>(
    &self,
    buffer: &Buffer<B>,
    offset: u64,
    content: &[T],
    last: Option<BufferState>,
    next: BufferState
) -> Result<(), Error>
[src]

Update buffer range content with provided data.

Update operation will actually be submitted to the graphics device queue upon next [flush_uploads] or [maintain] call to this Factory, and is guaranteed to take place after all previous operations that have been submitted to the same graphics queue on this Factory since last [flush_uploads] or [maintain] call

Note that buffer range will receive content as raw bytes. And interpretation will depend solely on device operation. Slice of generic type is allowed for convenience. It usually should be POD struct of numeric values or other POD structs.

#[repr(C)] can be used to guarantee defined memory layout of struct fields.

Safety

If buffer is used by device then last state must match the last usage state of the buffer before updating happen. In order to guarantee that updated content will be made visible to next device operation that reads content of the buffer range the next must match buffer usage state in that operation.

pub unsafe fn upload_from_staging_buffer(
    &self,
    buffer: &Buffer<B>,
    offset: u64,
    staging: Escape<Buffer<B>>,
    last: Option<BufferState>,
    next: BufferState
) -> Result<(), Error>
[src]

Update buffer content with provided staging buffer.

Update operation will actually be submitted to the graphics device queue upon next [flush_uploads] or [maintain] call to this Factory, and is guaranteed to take place after all previous operations that have been submitted to the same graphics queue on this Factory since last [flush_uploads] or [maintain] call

Safety

If buffer is used by device then last state must match the last usage state of the buffer before updating happen. In order to guarantee that updated content will be made visible to next device operation that reads content of the buffer range the next must match buffer usage state in that operation.

pub unsafe fn transition_image<impl Into>(
    &self,
    image: Handle<Image<B>>,
    image_range: SubresourceRange,
    last: impl Into,
    next: ImageState
) where
    impl Into: Into<ImageStateOrLayout>, 
[src]

Update image layers content with provided data. Transition part of image from one state to another.

Update operation will actually be submitted to the graphics device queue upon next [flush_uploads] or [maintain] call to this Factory, and is guaranteed to take place after all previous operations that have been submitted to the same graphics queue on this Factory since last [flush_uploads] or [maintain] call

Safety

Image must be created by this Factory. If image is used by device then last state must match the last usage state of the image before transition.

pub unsafe fn upload_image<T, impl Into>(
    &self,
    image: Handle<Image<B>>,
    data_width: u32,
    data_height: u32,
    image_layers: SubresourceLayers,
    image_offset: Offset,
    image_extent: Extent,
    content: &[T],
    last: impl Into,
    next: ImageState
) -> Result<(), Error> where
    impl Into: Into<ImageStateOrLayout>, 
[src]

Update image layers content with provided data.

Update operation will actually be submitted to the graphics device queue upon next [flush_uploads] or [maintain] call to this Factory, and is guaranteed to take place after all previous operations that have been submitted to the same graphics queue on this Factory since last [flush_uploads] or [maintain] call

Note that image layers will receive content as raw bytes. And interpretation will depend solely on device operation. Slice of generic type is allowed for convenience. It usually should be compatible type of pixel or channel. For example &[[u8; 4]] or &[u8] for Rgba8Unorm format.

Safety

Image must be created by this Factory. If image is used by device then last state must match the last usage state of the image before updating happen. In order to guarantee that updated content will be made visible to next device operation that reads content of the image layers the next must match image usage state in that operation.

pub fn blitter(&self) -> &Blitter<B>[src]

Get blitter instance

pub unsafe fn create_surface_with<T, impl FnOnce(&T) -> B::Surface>(
    &mut self,
    f: impl FnOnce(&T) -> B::Surface
) -> Surface<B> where
    T: Instance<Backend = B>,
    impl FnOnce(&T) -> B::Surface: FnOnce(&T) -> <B as Backend>::Surface
[src]

Create rendering surface from window.

Safety

Closure must return surface object created from raw instance provided as closure argument.

pub fn get_surface_compatibility(
    &self,
    surface: &Surface<B>
) -> (SurfaceCapabilities, Option<Vec<Format>>, Vec<PresentMode>)
[src]

Get compatibility of Surface

Panics

Panics if surface was not created by this Factory

pub fn get_surface_format(&self, surface: &Surface<B>) -> Format[src]

Get surface format.

Panics

Panics if surface was not created by this Factory

pub fn destroy_surface(&mut self, surface: Surface<B>)[src]

Destroy surface returning underlying window back to the caller.

Panics

Panics if surface was not created by this Factory

pub fn create_target(
    &self,
    surface: Surface<B>,
    extent: Extent2D,
    image_count: u32,
    present_mode: PresentMode,
    usage: Usage
) -> Result<Target<B>, Error>
[src]

Create target out of rendering surface.

The compatibility of the surface with the queue family which will present to this target must have already been checked using Factory::surface_support.

Panics

Panics if surface was not created by this Factory.

pub unsafe fn destroy_target(&self, target: Target<B>) -> Surface<B>[src]

Destroy target returning underlying surface back to the caller.

Safety

Target images must not be used by pending commands or referenced anywhere.

pub fn surface_support(&self, family: FamilyId, surface: &Surface<B>) -> bool[src]

Check if queue family supports presentation to the specified surface.

pub fn device(&self) -> &Device<B>[src]

Get raw device.

pub fn physical(&self) -> &<B as Backend>::PhysicalDevice[src]

Get raw physical device.

pub fn create_semaphore(&self) -> Result<<B as Backend>::Semaphore, OutOfMemory>[src]

Create new semaphore.

pub unsafe fn destroy_semaphore(&self, semaphore: <B as Backend>::Semaphore)[src]

Destroy semaphore.

Safety

Semaphore must be created by this Factory.

pub fn create_fence(&self, signaled: bool) -> Result<Fence<B>, OutOfMemory>[src]

Create new fence

pub fn reset_fence(&self, fence: &mut Fence<B>) -> Result<(), OutOfMemory>[src]

Wait for the fence become signeled.

pub fn reset_fences<'a, impl BorrowMut> + 'a, impl IntoIterator> + 'a)>>(
    &self,
    fences: impl IntoIterator> + 'a)>
) -> Result<(), OutOfMemory> where
    impl BorrowMut> + 'a: 'a + BorrowMut<Fence<B>>,
    impl IntoIterator> + 'a)>: IntoIterator<Item = &'a mut impl BorrowMut> + 'a>, 
[src]

Wait for the fence become signeled.

Safety

Fences must be created by this Factory.

pub fn wait_for_fence(
    &self,
    fence: &mut Fence<B>,
    timeout_ns: u64
) -> Result<bool, OomOrDeviceLost>
[src]

Wait for the fence become signeled.

pub fn wait_for_fences<'a, impl BorrowMut> + 'a, impl IntoIterator> + 'a)>>(
    &self,
    fences: impl IntoIterator> + 'a)>,
    wait_for: WaitFor,
    timeout_ns: u64
) -> Result<bool, OomOrDeviceLost> where
    impl BorrowMut> + 'a: 'a + BorrowMut<Fence<B>>,
    impl IntoIterator> + 'a)>: IntoIterator<Item = &'a mut impl BorrowMut> + 'a>, 
[src]

Wait for the fences become signeled.

pub fn destroy_fence(&self, fence: Fence<B>)[src]

Destroy fence.

Safety

Fence must be created by this Factory.

pub fn create_command_pool<R>(
    &self,
    family: &Family<B, QueueType>
) -> Result<CommandPool<B, QueueType, R>, OutOfMemory> where
    R: Reset
[src]

Create new command pool for specified family.

pub unsafe fn destroy_command_pool<C, R>(&self, pool: CommandPool<B, C, R>) where
    R: Reset
[src]

Create new command pool for specified family.

Safety

All command buffers allocated from the pool must be freed.

pub fn cleanup(&mut self, families: &Families<B>)[src]

Cleanup unused resources

pub fn flush_uploads(&mut self, families: &mut Families<B>)[src]

Flush uploads

pub fn flush_blits(&mut self, families: &mut Families<B>)[src]

Flush blits

pub fn maintain(&mut self, families: &mut Families<B>)[src]

Flush uploads and cleanup unused resources.

pub fn create_relevant_descriptor_set_layout(
    &self,
    bindings: Vec<DescriptorSetLayoutBinding>
) -> Result<DescriptorSetLayout<B>, OutOfMemory>
[src]

Create descriptor set layout with specified bindings.

pub fn create_descriptor_set_layout(
    &self,
    bindings: Vec<DescriptorSetLayoutBinding>
) -> Result<Escape<DescriptorSetLayout<B>>, OutOfMemory>
[src]

Create descriptor set layout with specified bindings.

pub fn create_relevant_descriptor_set(
    &self,
    layout: Handle<DescriptorSetLayout<B>>
) -> Result<DescriptorSet<B>, OutOfMemory>
[src]

Create descriptor sets with specified layout.

pub fn create_descriptor_set(
    &self,
    layout: Handle<DescriptorSetLayout<B>>
) -> Result<Escape<DescriptorSet<B>>, OutOfMemory>
[src]

Create descriptor sets with specified layout.

pub fn create_descriptor_sets<T>(
    &self,
    layout: Handle<DescriptorSetLayout<B>>,
    count: u32
) -> Result<T, OutOfMemory> where
    T: FromIterator<Escape<DescriptorSet<B>>>, 
[src]

Create descriptor sets with specified layout.

Safety

layout must be created by this Factory.

pub fn memory_utilization(&self) -> TotalMemoryUtilization[src]

Query memory utilization.

impl<B> Factory<B> where
    B: Backend
[src]

pub fn create_surface(&mut self, window: &Window) -> Surface<B>[src]

Create rendering surface from window.

Methods from Deref<Target = Device<B>>

pub fn id(&self) -> DeviceId[src]

Get device id.

pub fn raw(&self) -> &<B as Backend>::Device[src]

Get reference to raw device.

Trait Implementations

impl<B> Deref for Factory<B> where
    B: Backend
[src]

type Target = Device<B>

The resulting type after dereferencing.

impl<B> Debug for Factory<B> where
    B: Backend + Debug
[src]

impl<B> Drop for Factory<B> where
    B: Backend
[src]

Auto Trait Implementations

impl<B> Unpin for Factory<B> where
    B: Unpin,
    <B as Backend>::Buffer: Unpin,
    <B as Backend>::CommandBuffer: Unpin,
    <B as Backend>::CommandPool: Unpin,
    <B as Backend>::DescriptorPool: Unpin,
    <B as Backend>::DescriptorSet: Unpin,
    <B as Backend>::DescriptorSetLayout: Unpin,
    <B as Backend>::Device: Unpin,
    <B as Backend>::Fence: Unpin,
    <B as Backend>::Image: Unpin,
    <B as Backend>::ImageView: Unpin,
    <B as Backend>::Memory: Unpin,
    <B as Backend>::PhysicalDevice: Unpin,
    <B as Backend>::QueueFamily: Unpin,
    <B as Backend>::Sampler: Unpin

impl<B> Sync for Factory<B> where
    <B as Backend>::Buffer: Send + Sync,
    <B as Backend>::CommandBuffer: Send,
    <B as Backend>::CommandPool: Send,
    <B as Backend>::DescriptorPool: Send,
    <B as Backend>::DescriptorSet: Send + Sync,
    <B as Backend>::DescriptorSetLayout: Send + Sync,
    <B as Backend>::Device: Sync,
    <B as Backend>::Fence: Send,
    <B as Backend>::Image: Send + Sync,
    <B as Backend>::ImageView: Send + Sync,
    <B as Backend>::PhysicalDevice: Sync,
    <B as Backend>::QueueFamily: Sync,
    <B as Backend>::Sampler: Send + Sync

impl<B> Send for Factory<B> where
    <B as Backend>::Buffer: Send,
    <B as Backend>::CommandBuffer: Send,
    <B as Backend>::CommandPool: Send,
    <B as Backend>::DescriptorPool: Send,
    <B as Backend>::DescriptorSet: Send,
    <B as Backend>::DescriptorSetLayout: Send + Sync,
    <B as Backend>::Device: Send,
    <B as Backend>::Fence: Send,
    <B as Backend>::Image: Send + Sync,
    <B as Backend>::ImageView: Send,
    <B as Backend>::PhysicalDevice: Send,
    <B as Backend>::QueueFamily: Send,
    <B as Backend>::Sampler: Send + Sync

impl<B> !UnwindSafe for Factory<B>

impl<B> !RefUnwindSafe for Factory<B>

Blanket Implementations

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S where
    D: AdaptFrom<S, Swp, Dwp, T>,
    Dwp: WhitePoint,
    Swp: WhitePoint,
    T: Component + Float
[src]

fn adapt_into(self) -> D[src]

Convert the source color to the destination color using the bradford method by default Read more

impl<T> SetParameter for T[src]

fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
    T: Parameter<Self>, 
[src]

Sets value as a parameter of self.

impl<T> MemoryUsage for T where
    T: Deref + Debug,
    <T as Deref>::Target: MemoryUsage
[src]

impl<T> Supports<T> for T[src]

impl<T> Erased for T[src]

impl<T> Same<T> for T[src]

type Output = T

Should always be Self

impl<SS, SP> SupersetOf<SS> for SP where
    SS: SubsetOf<SP>, 
[src]

impl<T> Resource for T where
    T: Any + Send + Sync
[src]

impl<T> Any for T where
    T: Any
[src]

impl<T> Event for T where
    T: Send + Sync + 'static, 
[src]