pub(crate) fn load_buffer_with_staging<BufElem: Sized + Copy>(
    this: &Arc<RwLock<Self>>, buffer_type: BufferType, buffer: &[BufElem],
  ) -> SarektResult<(BufferImageHandle<BL>, BufferOrImage<BL::BackendHandle>)> {
    let mut buffer_store = this
      .write()
      .expect("Could not unlock BufferStore due to previous panic");

    let buffer_backend_handle = buffer_store
      .buffer_image_loader
      .load_buffer_with_staging(buffer_type, buffer)?;
    let buffer_or_image =
      BufferOrImage::new(buffer_backend_handle, ResourceType::Buffer(buffer_type));

    let inner_key = buffer_store
      .loaded_buffers_and_images
      .insert(buffer_or_image);

    Ok((
      BufferImageHandle {
        inner_key,
        resource_type: ResourceType::Buffer(buffer_type),
        buffer_store: Arc::downgrade(this),
      },
      buffer_or_image,
    ))
  }
/// Load a buffer and allocate memory into the backend/GPU and return a
/// handle.
Load a buffer and allocate memory into the backend/GPU and return a
handle.
Load a buffer and allocate memory into the backend / GPU and return a handle .
pub(crate) fn load_buffer_with_staging<BufElem: Sized + Copy>(
    this: &Arc<RwLock<Self>>, buffer_type: BufferType, buffer: &[BufElem],
  ) -> SarektResult<(BufferImageHandle<BL>, BufferOrImage<BL::BackendHandle>)> {
    let mut buffer_store = this
      .write()
      .expect("Could not unlock BufferStore due to previous panic");
    let buffer_backend_handle = buffer_store
      .buffer_image_loader
      .load_buffer_with_staging(buffer_type, buffer)?;
    let buffer_or_image =
      BufferOrImage::new(buffer_backend_handle, ResourceType::Buffer(buffer_type));
    let inner_key = buffer_store
      .loaded_buffers_and_images
      .insert(buffer_or_image);
    Ok((
      BufferImageHandle {
        inner_key,
        resource_type: ResourceType::Buffer(buffer_type),
        buffer_store: Arc::downgrade(this),
      },
      buffer_or_image,
    ))
  }
pub ( crate ) fn load_buffer_with_staging < BufElem : Sized + Copy > ( this : & Arc < RwLock < Self > > , buffer_type : BufferType , buffer : & [ BufElem ] , ) -> SarektResult < ( BufferImageHandle < BL > , BufferOrImage < BL :: BackendHandle > ) > { let mut buffer_store = this . write ( ) . expect ( " " ) ; let buffer_backend_handle = buffer_store . buffer_image_loader . load_buffer_with_staging ( buffer_type , buffer ) ? ; let buffer_or_image = BufferOrImage :: new ( buffer_backend_handle , ResourceType :: Buffer ( buffer_type ) ) ; let inner_key = buffer_store . loaded_buffers_and_images . insert ( buffer_or_image ) ; Ok ( ( BufferImageHandle { inner_key , resource_type : ResourceType :: Buffer ( buffer_type ) , buffer_store : Arc :: downgrade ( this ) , } , buffer_or_image , ) ) }
Load a buffer and allocate memory into the backend/GPU and return a
handle.
Load a buffer and allocate memory into the backend / GPU and return a handle .
this
&Arc<RwLock<Self>>
buffer_type
BufferType
buffer
&[BufElem]
this
&Arc<RwLock<Self>>
buffer_type
BufferType
buffer
&[BufElem]