loading
Generated Rust API reference for byte_engine.
byte_engine / rendering / loading
Module loading
Loading runs on its own timeline, parallel to rendering.
Read the loading timeline design before you change this module. It lists the rules that keep loading from ever blocking rendering, and the tests that guard them.
The Loader owns a context and the copy queue of the GraphicsDevice.
The renderer owns another context and the graphics queue. The two never wait on each other: the render thread
learns about loaded resources only through each pipeline's LoaderClient notifications.
Each rendering pipeline owns one loader client that hands out requests and receives residency notifications. Model that pipeline's resource families as variants of its key, request, and resident enums instead of creating an independent client for each resource type. Everything between request and residency happens on the loading thread: file I/O, decoding, staging writes, and the batched copies that make the resource resident.
Pipeline::request(request) -> lane: read metadata, request dependencies -> other lanes
lane: I/O, decode, write staging
lane: upload (plain data) -> loader: batch, submit on copy queue, wait
lane: send Ready { key, resident with detached images }
Pipeline::poll() <- render thread: intern images, adopt into scene stateBuild an integration
- Implement
LoadPipelineonce for one rendering pipeline.LoadPipeline::keyderives the pipeline-wide identity used to coalesce each ownedLoadPipeline::Request, andLoadPipeline::Residentis the finished value the render thread adopts. - Share every render buffer the lanes append to with
share_buffer, import it withLoader::import_buffer, and callspawnwith the loader and a lane count. Keep theLoaderClienton the render thread and run everyLoaderLaneon the loading thread. - Poll
LoaderClient::polluntil it returnsNoneonce per frame, intern the detached images eachEventcarries, and publish it to scene state.
Ownership
The client sends requests and publishes results. A lane owns whatever CPU bookkeeping the resource is written
into, so assigning a bindless slot or an append offset is lane work and needs no render-thread round trip. Lanes
request the dependencies a load discovers through LoaderLane::request as soon as its metadata names them, and
coalesce them with the client's requests where they pick requests up. The loader owns all GPU work of the
loading timeline.
Contents
Quick Reference
| Item | Kind | Description |
|---|---|---|
LoaderClient | struct | |
LoadError | struct | |
LoaderLane | struct | |
BufferRegion | struct | |
ImageDescription | struct | |
ImageRegion | struct | |
ImageUpload | struct | |
Loader | struct | |
NativeImageRegion | struct | |
NativeImageUpload | struct | |
Event | enum | |
LoadPipeline | trait | |
spawn | fn |
Structs
LoaderClient<P: LoadPipeline>
struct LoaderClient<P: LoadPipeline> {
// [REDACTED: Private Fields]
}Defined in crates/byte-engine/src/rendering/loading/client.rs:18-23
The LoaderClient struct is the render thread's whole view of loading.
It sends requests and publishes results. It holds no GPU state, because everything a resource needs was already done on a lane. Lanes schedule the dependencies they discover themselves, so their results arrive here like any other.
Implementations
-
fn request(&mut self, request: <P as >::Request)Related:
LoadPipelineRequests one resource, ignoring keys this client already requested.
A key that previously failed is retried. The request channel is unbounded and never blocks the
render thread; coalescing bounds it by the number of distinct keys the scene asks for.
-
fn reload(&mut self, request: <P as >::Request)Related:
LoadPipelineLoads one resource again, even when it is already loading or resident.
Use this when the stored resource changed, for example after a development rebake. Its result arrives
through
Self::polllike any other, and the render thread replaces what it adopted before. Resources itdepends on reload only when they are reloaded themselves.
-
fn poll(&mut self) -> Option<Event<P>>Related:
EventReturns the next completion without allocating an intermediate collection.
Call this until it returns
Noneonce per frame, before the frame reads scene state.
Trait Implementations
impl ArchivePointee for LoaderClient<P>
-
type ArchivedMetadata = () -
fn pointer_metadata(_: &<T as ArchivePointee>::ArchivedMetadata) -> <T as Pointee>::Metadata
impl<ST> CastableFrom for LoaderClient<P>
impl Downcast for LoaderClient<P>
-
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 LoaderClient<P>
-
fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>
impl<P: LoadPipeline> Drop for LoaderClient<P>
-
fn drop(&mut self)Closes the request stream so idle lanes stop, even though each lane can still send it dependencies.
impl Instrument for LoaderClient<P>
impl LayoutRaw for LoaderClient<P>
-
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
impl<T, N1> Niching for LoaderClient<P>
-
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool -
fn resolve_niched(out: Place<NichedOption<T, N1>>)
impl Pointee for LoaderClient<P>
-
type Metadata = ()
impl Read for LoaderClient<P>
impl WithSubscriber for LoaderClient<P>
LoadError
struct LoadError(String);Defined in crates/byte-engine/src/rendering/loading/lane.rs:22
The LoadError struct reports why one resource could not be made resident.
Trait Implementations
impl ArchivePointee for LoadError
-
type ArchivedMetadata = () -
fn pointer_metadata(_: &<T as ArchivePointee>::ArchivedMetadata) -> <T as Pointee>::Metadata
impl<ST> CastableFrom for LoadError
impl Debug for LoadError
-
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result
impl Display for LoadError
-
fn fmt(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result
impl Downcast for LoadError
-
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 LoadError
-
fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>
impl Instrument for LoadError
impl LayoutRaw for LoadError
-
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
impl<T, N1> Niching for LoadError
-
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool -
fn resolve_niched(out: Place<NichedOption<T, N1>>)
impl Pointee for LoadError
-
type Metadata = ()
impl Read for LoadError
impl ToString for LoadError
-
fn to_string(&self) -> String
impl WithSubscriber for LoadError
LoaderLane<P: LoadPipeline + ?Sized>
struct LoaderLane<P: LoadPipeline + ?Sized> {
// [REDACTED: Private Fields]
}Defined in crates/byte-engine/src/rendering/loading/lane.rs:78-92
The LoaderLane struct is one sequential worker that prepares uploads for the Loader.
Run each lane on its own async task on the loading thread. Lanes compete for the same request stream, so lane count is how many resources read and decode at once. The GPU work of every lane goes through the one loader.
Implementations
-
fn staging(&self) -> &Arc<UploadStagingArena>Related:
UploadStagingArenaReturns the shared staging arena that upload bytes are written into.
-
fn request(&self, request: <P as >::Request)Related:
LoadPipelineRequests a resource that the one being loaded depends on.
A lane picks it up right away, without a round trip through the render thread, and the render thread adopts
it like any other result. Requests for a key already loading or resident are ignored.
-
async fn upload<const N: usize>(&self, staging: StagingLease, images: [ImageUpload; N], buffers: SmallVec<[BufferRegion; 16]>) -> Result<[ghi::implementation::DetachedImage; N], LoadError>Related:
StagingLease,ImageUpload,BufferRegion,LoadErrorCreates images from staged mips, copies staged bytes into render buffers, and waits until the loader
finished every copy.
Every buffer destination is a handle from
Loader::import_buffer. Write only ranges no frame reads yet.The loader returns
stagingto the arena once the copies finished. The images come back detached, in uploadorder, ready for the render thread to intern.
-
async fn upload_native_image(&self, upload: NativeImageUpload) -> Result<ghi::implementation::DetachedImage, LoadError>Related:
NativeImageUpload,LoadErrorCreates one image, fills it straight from its file through native I/O, and waits until the reads finished.
-
async fn run(self)Serves requests until the client is dropped.
Trait Implementations
impl ArchivePointee for LoaderLane<P>
-
type ArchivedMetadata = () -
fn pointer_metadata(_: &<T as ArchivePointee>::ArchivedMetadata) -> <T as Pointee>::Metadata
impl<ST> CastableFrom for LoaderLane<P>
impl Downcast for LoaderLane<P>
-
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 LoaderLane<P>
-
fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>
impl Instrument for LoaderLane<P>
impl LayoutRaw for LoaderLane<P>
-
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
impl<T, N1> Niching for LoaderLane<P>
-
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool -
fn resolve_niched(out: Place<NichedOption<T, N1>>)
impl Pointee for LoaderLane<P>
-
type Metadata = ()
impl Read for LoaderLane<P>
impl WithSubscriber for LoaderLane<P>
BufferRegion
struct BufferRegion {
pub offset: usize,
pub destination: ghi::BaseBufferHandle,
pub destination_offset: usize,
pub size: usize,
}Defined in crates/byte-engine/src/rendering/loading/loader.rs:165-172
The BufferRegion struct copies one staged byte range into a render buffer the loader imported.
Fields
-
offset:usizeThe byte offset from the start of the staging lease.
-
destination:ghi::BaseBufferHandleA handle returned by
Loader::import_buffer.
Trait Implementations
impl ArchivePointee for BufferRegion
-
type ArchivedMetadata = () -
fn pointer_metadata(_: &<T as ArchivePointee>::ArchivedMetadata) -> <T as Pointee>::Metadata
impl<ST> CastableFrom for BufferRegion
impl Clone for BufferRegion
-
fn clone(&self) -> BufferRegionRelated:
BufferRegion
impl Copy for BufferRegion
impl Debug for BufferRegion
-
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result
impl Downcast for BufferRegion
-
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 BufferRegion
-
fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>
impl Eq for BufferRegion
impl<K> Equivalent for BufferRegion
-
fn equivalent(&self, key: &K) -> bool
impl Instrument for BufferRegion
impl LayoutRaw for BufferRegion
-
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
impl<T, N1> Niching for BufferRegion
-
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool -
fn resolve_niched(out: Place<NichedOption<T, N1>>)
impl PartialEq for BufferRegion
-
fn eq(&self, other: &BufferRegion) -> boolRelated:
BufferRegion
impl Pointee for BufferRegion
-
type Metadata = ()
impl Read for BufferRegion
impl StructuralPartialEq for BufferRegion
impl WithSubscriber for BufferRegion
ImageDescription
struct ImageDescription {
pub name: String,
pub format: ghi::Formats,
pub extent: utils::Extent,
pub mip_levels: u32,
pub cube: bool,
}Defined in crates/byte-engine/src/rendering/loading/loader.rs:127-134
The ImageDescription struct names and shapes one image the loader creates for an upload.
Loader images live in device memory, never change size, and are sampled once their upload completes.
Fields
-
cube:boolWhether the image has six layers that shaders sample as a cube.
Trait Implementations
impl ArchivePointee for ImageDescription
-
type ArchivedMetadata = () -
fn pointer_metadata(_: &<T as ArchivePointee>::ArchivedMetadata) -> <T as Pointee>::Metadata
impl<ST> CastableFrom for ImageDescription
impl Downcast for ImageDescription
-
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 ImageDescription
-
fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>
impl Instrument for ImageDescription
impl LayoutRaw for ImageDescription
-
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
impl<T, N1> Niching for ImageDescription
-
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool -
fn resolve_niched(out: Place<NichedOption<T, N1>>)
impl Pointee for ImageDescription
-
type Metadata = ()
impl Read for ImageDescription
impl WithSubscriber for ImageDescription
ImageRegion
struct ImageRegion {
pub offset: usize,
pub bytes_per_row: usize,
pub bytes_per_image: usize,
pub mip_level: u32,
}Defined in crates/byte-engine/src/rendering/loading/loader.rs:149-155
The ImageRegion struct places one mip of an image upload inside its staging lease.
Fields
-
offset:usizeThe byte offset from the start of the staging lease.
Trait Implementations
impl ArchivePointee for ImageRegion
-
type ArchivedMetadata = () -
fn pointer_metadata(_: &<T as ArchivePointee>::ArchivedMetadata) -> <T as Pointee>::Metadata
impl<ST> CastableFrom for ImageRegion
impl Clone for ImageRegion
-
fn clone(&self) -> ImageRegionRelated:
ImageRegion
impl Copy for ImageRegion
impl Debug for ImageRegion
-
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result
impl Downcast for ImageRegion
-
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 ImageRegion
-
fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>
impl Eq for ImageRegion
impl<K> Equivalent for ImageRegion
-
fn equivalent(&self, key: &K) -> bool
impl Instrument for ImageRegion
impl LayoutRaw for ImageRegion
-
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
impl<T, N1> Niching for ImageRegion
-
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool -
fn resolve_niched(out: Place<NichedOption<T, N1>>)
impl PartialEq for ImageRegion
-
fn eq(&self, other: &ImageRegion) -> boolRelated:
ImageRegion
impl Pointee for ImageRegion
-
type Metadata = ()
impl Read for ImageRegion
impl StructuralPartialEq for ImageRegion
impl WithSubscriber for ImageRegion
ImageUpload
struct ImageUpload {
pub description: ImageDescription,
pub regions: smallvec::SmallVec<[ImageRegion; 16]>,
}Defined in crates/byte-engine/src/rendering/loading/loader.rs:158-161
The ImageUpload struct pairs one image with the staged mips that fill it.
Trait Implementations
impl ArchivePointee for ImageUpload
-
type ArchivedMetadata = () -
fn pointer_metadata(_: &<T as ArchivePointee>::ArchivedMetadata) -> <T as Pointee>::Metadata
impl<ST> CastableFrom for ImageUpload
impl Downcast for ImageUpload
-
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 ImageUpload
-
fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>
impl Instrument for ImageUpload
impl LayoutRaw for ImageUpload
-
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
impl<T, N1> Niching for ImageUpload
-
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool -
fn resolve_niched(out: Place<NichedOption<T, N1>>)
impl Pointee for ImageUpload
-
type Metadata = ()
impl Read for ImageUpload
impl WithSubscriber for ImageUpload
Loader
struct Loader {
// [REDACTED: Private Fields]
}Defined in crates/byte-engine/src/rendering/loading/loader.rs:48-53
The Loader struct owns the loading timeline: its context, its copy queue, and the staging memory lanes share.
Lanes hand it uploads as plain data. It collects them into one batch until the batch window elapses, staging
runs out, or every busy lane is waiting on it, submits the batch on the copy queue, and keeps collecting the next
batch while the GPU copies. One batch is in flight at a time: the next one waits until the copy queue is free
again. Finished images leave the loader context as ghi::implementation::DetachedImage values. Lanes report
them to the render thread, which interns them when it adopts the notification. The render thread never waits on
the loader.
Create it with Self::new, import every render buffer that lanes append to with Self::import_buffer, and
create lanes with spawn. Next, start it with Self::run on the thread that runs the lanes.
See the loading timeline design for the batching and staging rules.
Implementations
-
fn new(device: &GraphicsDevice, parameters: impl Parameters) -> SelfRelated:
GraphicsDeviceCreates the loader context on
device's copy queue and the staging memory lanes share.Parameters
Read from
parameters, therender.loadingsubtree of the application's:batch-window: Milliseconds a batch collects uploads before the loader submits it. Defaults to 4.
-
fn import_buffer<T: ?Sized>(&mut self, buffer: ghi::implementation::SharedBuffer<T>) -> ghi::BufferHandle<T>Imports a buffer the render context shared, so lanes can append to it with
BufferRegioncopies.Next, pass the returned handle to the lanes that write the buffer.
-
fn run(self, runtime: &compio::runtime::Runtime)Starts the loader's tasks on
runtime.Run it on the thread that runs the lanes. The loader stops once every lane is gone and its last batch is
finished.
Trait Implementations
impl ArchivePointee for Loader
-
type ArchivedMetadata = () -
fn pointer_metadata(_: &<T as ArchivePointee>::ArchivedMetadata) -> <T as Pointee>::Metadata
impl<ST> CastableFrom for Loader
impl Downcast for Loader
-
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 Instrument for Loader
impl LayoutRaw for Loader
-
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
impl<T, N1> Niching for Loader
-
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool -
fn resolve_niched(out: Place<NichedOption<T, N1>>)
impl Pointee for Loader
-
type Metadata = ()
impl Read for Loader
impl WithSubscriber for Loader
NativeImageRegion
struct NativeImageRegion {
pub file_offset: usize,
pub mip_level: u32,
pub extent: utils::Extent,
pub bytes_per_row: usize,
pub bytes_per_image: usize,
}Defined in crates/byte-engine/src/rendering/loading/loader.rs:184-191
The NativeImageRegion struct locates one decoded mip inside a native file.
Fields
-
file_offset:usizeThe byte offset of the mip in the file's decoded stream.
Trait Implementations
impl ArchivePointee for NativeImageRegion
-
type ArchivedMetadata = () -
fn pointer_metadata(_: &<T as ArchivePointee>::ArchivedMetadata) -> <T as Pointee>::Metadata
impl<ST> CastableFrom for NativeImageRegion
impl Clone for NativeImageRegion
-
fn clone(&self) -> NativeImageRegionRelated:
NativeImageRegion
impl Copy for NativeImageRegion
impl Debug for NativeImageRegion
-
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result
impl Downcast for NativeImageRegion
-
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 NativeImageRegion
-
fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>
impl Instrument for NativeImageRegion
impl LayoutRaw for NativeImageRegion
-
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
impl<T, N1> Niching for NativeImageRegion
-
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool -
fn resolve_niched(out: Place<NichedOption<T, N1>>)
impl Pointee for NativeImageRegion
-
type Metadata = ()
impl Read for NativeImageRegion
impl WithSubscriber for NativeImageRegion
NativeImageUpload
struct NativeImageUpload {
pub description: ImageDescription,
pub path: std::path::PathBuf,
pub compression: ghi::io::ResourceIoCompression,
pub regions: smallvec::SmallVec<[NativeImageRegion; 16]>,
}Defined in crates/byte-engine/src/rendering/loading/loader.rs:175-180
The NativeImageUpload struct fills one image straight from a file through the device's native I/O queue.
Trait Implementations
impl ArchivePointee for NativeImageUpload
-
type ArchivedMetadata = () -
fn pointer_metadata(_: &<T as ArchivePointee>::ArchivedMetadata) -> <T as Pointee>::Metadata
impl<ST> CastableFrom for NativeImageUpload
impl Downcast for NativeImageUpload
-
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 NativeImageUpload
-
fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>
impl Instrument for NativeImageUpload
impl LayoutRaw for NativeImageUpload
-
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
impl<T, N1> Niching for NativeImageUpload
-
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool -
fn resolve_niched(out: Place<NichedOption<T, N1>>)
impl Pointee for NativeImageUpload
-
type Metadata = ()
impl Read for NativeImageUpload
impl WithSubscriber for NativeImageUpload
Enums
Event<P: LoadPipeline>
enum Event<P: LoadPipeline> {
Ready {
key: <P as >::Key,
resident: <P as >::Resident,
},
Failed {
key: <P as >::Key,
error: super::lane::LoadError,
},
}Defined in crates/byte-engine/src/rendering/loading/client.rs:8-11
The Event enum reports what a loader finished since the previous frame.
Trait Implementations
impl ArchivePointee for Event<P>
-
type ArchivedMetadata = () -
fn pointer_metadata(_: &<T as ArchivePointee>::ArchivedMetadata) -> <T as Pointee>::Metadata
impl<ST> CastableFrom for Event<P>
impl Downcast for Event<P>
-
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 Event<P>
-
fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>
impl Instrument for Event<P>
impl LayoutRaw for Event<P>
-
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
impl<T, N1> Niching for Event<P>
-
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool -
fn resolve_niched(out: Place<NichedOption<T, N1>>)
impl Pointee for Event<P>
-
type Metadata = ()
impl Read for Event<P>
impl WithSubscriber for Event<P>
Traits
LoadPipeline
trait LoadPipeline: Send + Sync + 'static { ... }Defined in crates/byte-engine/src/rendering/loading/lane.rs:39-64
The LoadPipeline trait defines how one rendering pipeline turns all its requests into resident GPU resources.
Implement this trait once per rendering pipeline. Represent meshes, materials, textures, and other resource families as variants of the associated types so they share one request registry and lane pool. Every method runs on the loading thread. Implementations are shared across lanes by reference, so any mutable loader-owned storage belongs behind interior mutability held by the implementation itself.
The returned future is deliberately not Send: resource reads are driven by a per-thread runtime, so a
lane's future never migrates between threads once it starts.
Associated Types
-
type Key: 5 -
type Request: 2 -
type Resident: 2
Required Methods
-
fn key(request: &<Self as >::Request) -> <Self as >::KeyDerives the stable logical identity used to coalesce one request.
-
fn load(&self, request: <Self as >::Request, lane: &mut LoaderLane<Self>) -> impl Future<Output = Result<<Self as >::Resident, LoadError>>Loads one resource end to end.
Functions
spawn
fn spawn<P: LoadPipeline>(loader: &super::loader::Loader, pipeline: P, lane_count: usize, queue_capacity: usize) -> (super::client::LoaderClient<P>, Vec<LoaderLane<P>>)Defined in crates/byte-engine/src/rendering/loading/lane.rs:195-220
Creates the single client and lane pool for one rendering pipeline.
Keep the client on the render thread and move every lane to a task on the loading thread, where
Loader::run runs too.