resource_loading
Generated Rust API reference for byte_engine.
byte_engine / rendering / resource_loading
Module resource_loading
Resource Manager to GHI utilities for loader lanes.
crate::rendering::loading owns request coalescing, lanes, the loader timeline, and completed residency
events. This module owns the reusable byte-preparation pieces lanes build on: upload staging and ordinary
sampled-texture loading.
Most pipelines request an image through the Resource Manager and call load_texture. Keep request identity,
bindless slots, samplers, and resident publication in the renderer-specific
crate::rendering::loading::LoadPipeline implementation.
Quick Reference
| Item | Kind | Description |
|---|---|---|
TextureTransferError | struct | |
StagingLease | struct | |
UploadStagingArena | struct | |
load_texture | fn |
Structs
TextureTransferError
struct TextureTransferError();Defined in crates/byte-engine/src/rendering/resource_loading/texture.rs:81
The TextureTransferError struct reports why a Resource Manager image could not become a GHI texture.
Trait Implementations
impl ArchivePointee for TextureTransferError
-
type ArchivedMetadata = () -
fn pointer_metadata(_: &<T as ArchivePointee>::ArchivedMetadata) -> <T as Pointee>::Metadata
impl<ST> CastableFrom for TextureTransferError
impl Debug for TextureTransferError
-
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result
impl Display for TextureTransferError
-
fn fmt(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result
impl Downcast for TextureTransferError
-
fn into_any(self: Box<T>) -> Box<dyn Any> -
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any> -
fn as_any(&self) -> &dyn Any -
fn as_any_mut(&mut self) -> &mut dyn Any
impl DowncastSync for TextureTransferError
-
fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>
impl Error for TextureTransferError
impl Instrument for TextureTransferError
impl LayoutRaw for TextureTransferError
-
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
impl<T, N1> Niching for TextureTransferError
-
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool -
fn resolve_niched(out: Place<NichedOption<T, N1>>)
impl Pointee for TextureTransferError
-
type Metadata = ()
impl Read for TextureTransferError
impl ToString for TextureTransferError
-
fn to_string(&self) -> String
impl WithSubscriber for TextureTransferError
StagingLease
struct StagingLease {
// [REDACTED: Private Fields]
}Defined in crates/byte-engine/src/rendering/resource_loading/upload_staging.rs:223-226
The StagingLease struct ties exclusive mapped bytes to their GPU-use lifetime.
Fill the region through Self::bytes_mut, describe where each part lies
relative to the start of the lease, and hand the lease to the loader with the
upload that reads it. Do not free it manually. Dropping the lease returns the
region to the worker, so the loader keeps it until the copy completes.
Implementations
-
fn bytes_mut(&mut self) -> &mut [u8]Returns exclusive CPU access to the persistently mapped region.
Finish all writes before handing the lease to the loader. The
exclusive borrow prevents concurrent safe access through this lease.
Trait Implementations
impl ArchivePointee for StagingLease
-
type ArchivedMetadata = () -
fn pointer_metadata(_: &<T as ArchivePointee>::ArchivedMetadata) -> <T as Pointee>::Metadata
impl<ST> CastableFrom for StagingLease
impl Downcast for StagingLease
-
fn into_any(self: Box<T>) -> Box<dyn Any> -
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any> -
fn as_any(&self) -> &dyn Any -
fn as_any_mut(&mut self) -> &mut dyn Any
impl DowncastSync for StagingLease
-
fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>
impl Drop for StagingLease
-
fn drop(&mut self)
impl Instrument for StagingLease
impl LayoutRaw for StagingLease
-
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
impl<T, N1> Niching for StagingLease
-
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool -
fn resolve_niched(out: Place<NichedOption<T, N1>>)
impl Pointee for StagingLease
-
type Metadata = ()
impl Read for StagingLease
impl WithSubscriber for StagingLease
UploadStagingArena
struct UploadStagingArena {
// [REDACTED: Private Fields]
}Defined in crates/byte-engine/src/rendering/resource_loading/upload_staging.rs:23-28
The UploadStagingArena struct gives loader lanes exclusive regions of one persistently mapped transfer buffer.
Share this lightweight client with asynchronous loader lanes. Request a
StagingLease with Self::allocate, load or convert directly into its
bytes, and hand the lease to the loader with the upload that reads it. The
Loader drops the lease once the GPU
finished the copy, and its region returns to UploadStagingWorker for
coalescing and reuse.
The arena owns raw access transferred from one GHI mapping, not the backing buffer or context. Keep the GHI context and mapped buffer alive until the arena, its worker, and every lease have been dropped.
Implementations
-
async fn allocate(self: &Arc<Self>, byte_count: usize, alignment: usize) -> Option<StagingLease>Related:
StagingLeaseWaits for one aligned exclusive region or rejects a request larger than the complete arena.
Allocation requests are served in FIFO order. A large request at the head
can therefore hold smaller requests until returned regions coalesce; this
favors predictable ordering over opportunistic reordering.
alignmentmust be a non-zero power of two.
Nonemeans the complete arena is toosmall or its worker has stopped.
Trait Implementations
impl ArchivePointee for UploadStagingArena
-
type ArchivedMetadata = () -
fn pointer_metadata(_: &<T as ArchivePointee>::ArchivedMetadata) -> <T as Pointee>::Metadata
impl<ST> CastableFrom for UploadStagingArena
impl Downcast for UploadStagingArena
-
fn into_any(self: Box<T>) -> Box<dyn Any> -
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any> -
fn as_any(&self) -> &dyn Any -
fn as_any_mut(&mut self) -> &mut dyn Any
impl DowncastSync for UploadStagingArena
-
fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>
impl Instrument for UploadStagingArena
impl LayoutRaw for UploadStagingArena
-
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
impl<T, N1> Niching for UploadStagingArena
-
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool -
fn resolve_niched(out: Place<NichedOption<T, N1>>)
impl Pointee for UploadStagingArena
-
type Metadata = ()
impl Read for UploadStagingArena
impl WithSubscriber for UploadStagingArena
Functions
load_texture
async fn load_texture<P: LoadPipeline>(reference: resource_management::Reference<resource_management::resources::image::Image>, name: &str, lane: &crate::rendering::loading::LoaderLane<P>) -> Result<ghi::implementation::DetachedImage, TextureTransferError>Defined in crates/byte-engine/src/rendering/resource_loading/texture.rs:30-77
Loads every mip of an image resource through the loader and returns the finished image.
CPU-readable resources are staged and copied. GPU-backed resources are read straight from their file through native I/O. Next, return the image in the pipeline's resident value so the render thread interns it and binds it with a sampler the pipeline owns.