pub struct ResourceMap<'a> { /* private fields */ }
Expand description
Maps [virtual resources] to physical resources.
Implementations§
Source§impl<'a> ResourceMap<'a>
impl<'a> ResourceMap<'a>
Sourcepub fn new(
executable: &'a ExecutableTaskGraph<impl ?Sized>,
) -> Result<Self, InvalidSlotError>
pub fn new( executable: &'a ExecutableTaskGraph<impl ?Sized>, ) -> Result<Self, InvalidSlotError>
Creates a new ResourceMap
mapping the virtual resources of the given executable
.
Sourcepub fn insert_buffer(
&mut self,
virtual_id: Id<Buffer>,
physical_id: Id<Buffer>,
) -> Result<(), InvalidSlotError>
pub fn insert_buffer( &mut self, virtual_id: Id<Buffer>, physical_id: Id<Buffer>, ) -> Result<(), InvalidSlotError>
Inserts a mapping from the [virtual buffer resource] corresponding to virtual_id
to the
physical resource corresponding to physical_id
.
§Panics
- Panics if the physical resource doesn’t match the virtual resource.
- Panics if the physical resource already has a mapping from another virtual resource.
Sourcepub unsafe fn insert_buffer_unchecked(
&mut self,
virtual_id: Id<Buffer>,
physical_id: Id<Buffer>,
)
pub unsafe fn insert_buffer_unchecked( &mut self, virtual_id: Id<Buffer>, physical_id: Id<Buffer>, )
Inserts a mapping from the [virtual buffer resource] corresponding to virtual_id
to the
physical resource corresponding to physical_id
without doing any checks.
§Safety
virtual_id
must be a valid virtual resource ID.physical_id
must be a valid physical resource ID.- The physical resource must match the virtual resource.
- The physical resource must not have a mapping from another virtual resource.
Sourcepub fn insert_image(
&mut self,
virtual_id: Id<Image>,
physical_id: Id<Image>,
) -> Result<(), InvalidSlotError>
pub fn insert_image( &mut self, virtual_id: Id<Image>, physical_id: Id<Image>, ) -> Result<(), InvalidSlotError>
Inserts a mapping from the [virtual image resource] corresponding to virtual_id
to the
physical resource corresponding to physical_id
.
§Panics
- Panics if the physical resource doesn’t match the virtual resource.
- Panics if the physical resource already has a mapping from another virtual resource.
- Panics if
virtual_id
refers to a swapchain image.
Sourcepub unsafe fn insert_image_unchecked(
&mut self,
virtual_id: Id<Image>,
physical_id: Id<Image>,
)
pub unsafe fn insert_image_unchecked( &mut self, virtual_id: Id<Image>, physical_id: Id<Image>, )
Inserts a mapping from the [virtual image resource] corresponding to virtual_id
to the
physical resource corresponding to physical_id
without doing any checks.
§Safety
virtual_id
must be a valid virtual resource ID.physical_id
must be a valid physical resource ID.- The physical resource must match the virtual resource.
- The physical resource must not have a mapping from another virtual resource.
Sourcepub fn insert_swapchain(
&mut self,
virtual_id: Id<Swapchain>,
physical_id: Id<Swapchain>,
) -> Result<(), InvalidSlotError>
pub fn insert_swapchain( &mut self, virtual_id: Id<Swapchain>, physical_id: Id<Swapchain>, ) -> Result<(), InvalidSlotError>
Inserts a mapping from the [virtual swapchain resource] corresponding to virtual_id
to
the physical resource corresponding to physical_id
.
§Panics
- Panics if the physical resource doesn’t match the virtual resource.
- Panics if the physical resource already has a mapping from another virtual resource.
Sourcepub unsafe fn insert_swapchain_unchecked(
&mut self,
virtual_id: Id<Swapchain>,
physical_id: Id<Swapchain>,
)
pub unsafe fn insert_swapchain_unchecked( &mut self, virtual_id: Id<Swapchain>, physical_id: Id<Swapchain>, )
Inserts a mapping from the [virtual swapchain resource] corresponding to virtual_id
to
the physical resource corresponding to physical_id
without doing any checks.
§Safety
virtual_id
must be a valid virtual resource ID.physical_id
must be a valid physical resource ID.- The physical resource must match the virtual resource.
- The physical resource must not have a mapping from another virtual resource.
Sourcepub fn is_exhaustive(&self) -> bool
pub fn is_exhaustive(&self) -> bool
Returns true
if the map maps every virtual resource.