Byte Engine Docs
View on docs.rs

graphics

Generated Rust API reference for byte_engine.

byte_engine / application / graphics


Module graphics

Headed application runtime and graphics setup entry points.

Construct GraphicsApplication, configure it with either default_setup or selected setup functions, then run its loop. The triangle example uses the complete default stack; the window example creates only a window.

Rendering setup remains in this module because it coordinates the world, renderer, and application factories. General startup defaults and external adapters are kept behind the setup functions re-exported from this module.

Follow the sample project guide for the complete application setup sequence.

Contents

Quick Reference

Modules

  • defaults — Conventional setup components for [GraphicsApplication].

Structs

GraphicsApplication

struct GraphicsApplication {
    // [REDACTED: Private Fields]
}

Defined in crates/byte-engine/src/application/graphics/mod.rs:47-90

The GraphicsApplication struct owns the headed runtime and coordinates windows, input, worlds, resources, audio workers, and rendering.

Use default_setup for the conventional engine stack. Use setup_default_window, setup_default_input, and the render-pass setup functions independently when an application needs explicit composition. After setup, call Self::do_loop to run the application, or Self::tick_with when application code must run during each tick.

Configuration

  • kill-after: Closes the application after this number of ticks. The default is None.
  • assets-path: Selects the debug-build asset directory. Relative overrides use the current working directory. In development, the default is assets under CARGO_MANIFEST_DIR when available, then beside the executable.
  • resources.path: Selects the resource directory. Relative overrides use the current working directory. In development, the default uses CARGO_MANIFEST_DIR when available; otherwise, it is beside the executable.
  • render.debug: Enables validation layers. The default is true in debug builds.
  • render.debug.dump: Enables graphics API logging. The default is false.
  • render.debug.extended: Enables extended validation. The default is false.
  • messages.max-topics: Sets the maximum number of typed routes. The default is 64.
  • messages.cells-per-topic: Sets the fixed payload-cell budget for each typed route. The default is 512.
  • messages.cell-bytes: Sets the size of each payload cell in bytes. The default is 256.
  • messages.cell-alignment: Sets the alignment of each payload cell. The default is 64.
  • messages.listeners-per-topic: Sets the maximum simultaneous listeners on one typed route. The default is 64.
  • render.pass.<name>: Selects enabled or bypassed for the named render pass.
  • render.gtao.radius: Sets the GTAO world-space search radius. The default is 1.0.
  • render.gtao.samples-per-ray: Sets the GTAO samples along each ray. The default is 6.
  • render.gtao.radial-rays: Sets the even number of GTAO ray directions. The default is 8.
  • render.cone-shadow-map-pool.capacity: Sets the startup maximum for reusable cone-light shadow maps per sink. Maps allocate on first use; the default capacity is 4.
  • render.point-shadow-map-pool.capacity: Sets the startup maximum for reusable point-light cube shadow maps per sink. Maps allocate on first use; the default capacity is 4.

See the sample project guide for a complete GraphicsApplication setup.

Implementations

  • fn frame_allocator(&self) -> &bumpalo::Bump

    Returns frame-local storage for temporary allocations during the current tick.

  • fn configuration(&self) -> &Configuration

    Related: Configuration

    Returns the configuration exchange used to inspect startup update results.

  • fn tick_with<R, F: FnOnce(&mut Self, Time) -> R>(&mut self, f: F) -> Option<R>

    Runs one graphics tick and lets application code update state before rendering.

  • fn close(&mut self)

    Flags the application for closing.

  • fn input_system(&self) -> &input::InputManager

    Related: InputManager

    Returns the input manager that owns devices, triggers, and action state.

  • fn renderer(&self) -> &Renderer

    Related: Renderer

    Returns the renderer used by setup functions and advanced render integrations.

  • fn renderer_mut(&mut self) -> &mut Renderer

    Related: Renderer

    Returns mutable renderer access for application-defined pipeline setup.

    Use this during startup to create renderer-owned GHI resources. For an

    asynchronous resource integration, create the mapped transfer buffer and

    crate::rendering::resource_loading::UploadStagingArena here, keep the

    buffer handle in the pipeline manager's upload store, and run the staging

    worker and resource servers through application-owned tasks. Then call

    Renderer::add_pipeline_manager before the application starts rendering.

    The opposite lifetime is equally important: stop and join those tasks

    before this application drops the renderer. The built-in Simple and

    Visibility setup functions demonstrate that shutdown ordering.

  • fn window_factory(&self) -> &Factory<Window>

    Related: Window

    Returns the factory used to request new windows.

  • fn action_factory(&self) -> &Factory<Action>

    Related: Action

    Returns the factory used to register input actions.

  • fn messages(&self) -> &MessageScope

    Related: MessageScope

    Returns the application-owned namespace used by headed-runtime channels and factories.

    Next, call MessageScope::channel or MessageScope::factory to add an

    application-defined message route without declaring its type at startup.

  • fn message_bus(&self) -> &MessageBus

    Related: MessageBus

    Returns the shared fixed-storage message bus for diagnostics and new scopes.

    Next, call MessageBus::topics to inspect registered routes or

    MessageBus::new_scope to isolate routes owned by another subsystem.

  • fn world(&self) -> &DefaultWorld

    Related: DefaultWorld

    Returns the default world updated by the graphics application loop.

  • fn world_mut(&mut self) -> &mut DefaultWorld

    Related: DefaultWorld

    Returns mutable access to the default world updated by the graphics application loop.

  • fn generator_factory(&self) -> &Factory<Arc<dyn Generator>>

    Related: Generator

    Returns the audio generator factory used by default audio setup.

  • fn do_loop(&mut self)

    Runs ticks until the application is closed.

  • fn do_loop_with<F: FnOnce(&mut Self, Time) + Copy>(&mut self, f: F)

    Runs ticks with an application callback until the application is closed.

  • fn resource_manager(&self) -> &ResourceManager

    Returns the resource manager shared by rendering and asset setup.

  • fn resource_manager_handle(&self) -> EntityHandle<ResourceManager>

    Related: EntityHandle

    Returns shared ownership of the resource manager for application-owned async systems.

    Use this handle when constructing loaders such as

    crate::animation::graph::AnimationPool. Next, spawn the returned

    worker on the application's chosen async runtime.

Trait Implementations

impl Application for GraphicsApplication
  • fn new(name: &str, parameters: &[Parameter]) -> Self

    Related: Parameter

  • fn get_name(&self) -> &str
  • fn tick(&mut self) -> bool
impl ArchivePointee for GraphicsApplication
  • type ArchivedMetadata = ()
  • fn pointer_metadata(_: &<T as ArchivePointee>::ArchivedMetadata) -> <T as Pointee>::Metadata
impl<ST> CastableFrom for GraphicsApplication
impl Downcast for GraphicsApplication
  • 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 Drop for GraphicsApplication
  • fn drop(&mut self)
impl Instrument for GraphicsApplication
impl LayoutRaw for GraphicsApplication
  • fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
impl<T, N1> Niching for GraphicsApplication
  • unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
  • fn resolve_niched(out: Place<NichedOption<T, N1>>)
impl Pointable for GraphicsApplication
  • const ALIGN: usize
  • type Init = T
  • unsafe fn init(init: <T as Pointable>::Init) -> usize
  • unsafe fn deref<'a>(ptr: usize) -> &'a T
  • unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T
  • unsafe fn drop(ptr: usize)
impl Pointee for GraphicsApplication
  • type Metadata = ()
impl Read for GraphicsApplication
impl WithSubscriber for GraphicsApplication

Functions

setup_aces_color_grading_render_pass

fn setup_aces_color_grading_render_pass(application: &mut GraphicsApplication, lut: crate::rendering::render_passes::lut::PreparedLut)

Defined in crates/byte-engine/src/application/graphics/pipeline.rs:444-449

Installs a fused ACEScg/ACEScct grading and SDR output pass from a prepared LUT.

The LUT must accept and return ACEScct values. The pass uses an AP1-aware fitted SDR transform; it does not claim ACES reference-transform compliance. Load it with crate::rendering::render_passes::lut::PreparedLut::load on application-owned asynchronous work before calling this setup function. Call this after scene-linear effects. Later passes consume its remapped main output.

setup_aces_tonemap_render_pass

fn setup_aces_tonemap_render_pass(application: &mut GraphicsApplication)

Defined in crates/byte-engine/src/application/graphics/pipeline.rs:421-426

Installs the ACES v1 tonemapping pass for post-scene color mapping.

setup_agx_tonemap_render_pass

fn setup_agx_tonemap_render_pass(application: &mut GraphicsApplication)

Defined in crates/byte-engine/src/application/graphics/pipeline.rs:414-418

Installs the AGX tonemapping pass for post-scene color mapping.

setup_atmosphere_sky_render_pass

fn setup_atmosphere_sky_render_pass(application: &mut GraphicsApplication)

Defined in crates/byte-engine/src/application/graphics/pipeline.rs:509-522

Installs the atmosphere sky pass used as a post-scene background.

setup_bloom_render_pass

fn setup_bloom_render_pass(application: &mut GraphicsApplication, settings: crate::rendering::render_passes::bloom::BloomPassSettings)

Defined in crates/byte-engine/src/application/graphics/pipeline.rs:429-435

Registers a reusable bloom pass that should run before tonemapping.

setup_dwg_color_grading_render_pass

fn setup_dwg_color_grading_render_pass(application: &mut GraphicsApplication, lut: crate::rendering::render_passes::lut::PreparedLut)

Defined in crates/byte-engine/src/application/graphics/pipeline.rs:459-464

Installs a fused DaVinci Wide Gamut/Intermediate grading and SDR output pass from a prepared LUT.

The LUT must accept and return DaVinci Wide Gamut/Intermediate values. The pass uses AgX for SDR display rendering and does not claim parity with DaVinci Resolve color management. Load it with crate::rendering::render_passes::lut::PreparedLut::load on application-owned asynchronous work before calling this setup function. Call this after scene-linear effects. Later passes consume its remapped main output.

setup_lut_render_pass

fn setup_lut_render_pass(application: &mut GraphicsApplication, lut: crate::rendering::render_passes::lut::PreparedLut)

Defined in crates/byte-engine/src/application/graphics/pipeline.rs:486-495

Installs a 3D LUT grading pass from asynchronously prepared resource data.

Load the resource once with crate::rendering::render_passes::lut::PreparedLut::load on application-owned asynchronous work. Each sink shares those immutable bytes while creating its own renderer-owned image. Call this after passes that produce the HDR main target and before tone mapping.

setup_pbr_visibility_shading_render_pipeline

fn setup_pbr_visibility_shading_render_pipeline(application: &mut GraphicsApplication, spawn_loading_task: impl FnOnce(std::boxed::Box<dyn FnOnce(&compio::runtime::Runtime) + Send>))

Defined in crates/byte-engine/src/application/graphics/pipeline.rs:141-353

Installs the visibility-buffer PBR scene pipeline and its async upload worker.

Visibility demonstrates the same shared lifecycle with four preparation lanes, meshlets and parallel vertex streams, material and bindless texture slots, CPU texture transfers, and native GPU-I/O adoption. Those choices are implemented by Visibility's preparer and store; they are not requirements of the shared loader.

The supplied callback must run the staging worker and every preparation server on application-owned async tasks. Join those tasks before renderer shutdown so no worker retains a mapping or detached GHI factory after its context is dropped.

Next, create an Environment through DefaultWorld::factory to select the HDR image used for ambient and specular reflections.

setup_simple_render_pipeline

fn setup_simple_render_pipeline(application: &mut GraphicsApplication, spawn_loading_task: impl FnOnce(std::boxed::Box<dyn FnOnce(&compio::runtime::Runtime) + Send>))

Defined in crates/byte-engine/src/application/graphics/pipeline.rs:20-123

Installs the simple scene pipeline and registers its asynchronous mesh-loading worker.

This setup is the smallest end-to-end implementation of rendering::resource_loading. It creates one mapped staging arena, one preparation server, and a Simple-owned store whose position and index streams intentionally differ from Visibility storage. The supplied callback owns task placement so this function does not impose an executor or thread policy on the application. Simple's shaders use the renderer's asynchronous pipeline compilation servers; this setup never waits for shader resources.

Add the supplied task to a queue from defaults::build_deferred_tasks_queue, then start that queue with defaults::launch_deferred_tasks_thread after every subsystem has registered its work. At shutdown, join that task before dropping the renderer and mapped upload buffer.

setup_smaa_render_pass

fn setup_smaa_render_pass(application: &mut GraphicsApplication)

Defined in crates/byte-engine/src/application/graphics/pipeline.rs:502-506

Installs spatial SMAA for every current and future render sink.

This adds a self-contained post-scene pass without coalescing it with tone mapping or other independent passes. Call it after the setup that produces the main color input you want SMAA to filter, and before any overlay pass you want to keep sharp.

setup_ui_render_pass

fn setup_ui_render_pass(application: &mut GraphicsApplication, ui: &crate::core::factory::Factory<crate::ui::layout::engine::Render>)

Defined in crates/byte-engine/src/application/graphics/pipeline.rs:358-401

Installs the retained UI render pass fed by UI render messages from ui.

Register this pass before publishing renders that every sink must observe.

default_setup

fn default_setup(application: &mut super::GraphicsApplication)

Defined in crates/byte-engine/src/application/graphics/defaults.rs:15-40

Installs the standard assets, input devices, audio worker, visibility rendering pipeline, and window.

After setup, create application actions through GraphicsApplication::action_factory, select scene lighting through crate::gameplay::world::DefaultWorld::factory, and run the application with GraphicsApplication::do_loop.

setup_animation_pool

fn setup_animation_pool(application: &mut super::GraphicsApplication, byte_budget: std::num::NonZeroUsize, spawn_loading_task: impl FnOnce(Box<dyn FnOnce(&compio::runtime::Runtime) + Send>)) -> crate::animation::graph::AnimationPool

Defined in crates/byte-engine/src/application/graphics/defaults.rs:344-358

Creates an AnimationPool with the given decoded-clip byte budget and spawns its load worker on the application's async runtime.

Next, call AnimationPool::update once per tick before advancing graph players that share the pool, then create animation graphs through crate::animation::graph::AnimationGraphPlayer.

setup_default_audio

fn setup_default_audio(application: &mut super::GraphicsApplication, spawn_loading_task: impl FnOnce(Box<dyn FnOnce(&compio::runtime::Runtime) + Send>))

Defined in crates/byte-engine/src/application/graphics/defaults.rs:263-336

Starts the audio worker, its byte-bounded global sample pool, and the standard audio entity listeners.

Next, submit a crate::audio::generator::Generator through GraphicsApplication::generator_factory to make it available to the audio worker, or create an crate::audio::graph::AudioGraph through crate::gameplay::world::DefaultWorld::audio_graph_factory.

setup_default_input

fn setup_default_input(application: &mut super::GraphicsApplication)

Defined in crates/byte-engine/src/application/graphics/defaults.rs:238-254

Installs the device classes expected by super::process_default_window_input.

Next, create application-level actions through GraphicsApplication::action_factory. The application tick translates window events and emits their resolved action values.

setup_default_pipeline_compilation

fn setup_default_pipeline_compilation(application: &mut super::GraphicsApplication)

Defined in crates/byte-engine/src/application/graphics/defaults.rs:47-75

Starts the renderer's pending pipeline compiler servers on application-owned threads.

This setup is idempotent. Call it when composing a graphics application without default_setup before registering pipeline managers or render passes that request asynchronous pipelines.

setup_default_resource_and_asset_management

fn setup_default_resource_and_asset_management(application: &mut super::GraphicsApplication, generator: impl ProgramGenerator + 'static)

Defined in crates/byte-engine/src/application/graphics/defaults.rs:143-223

In debug builds, connects the asset directory and standard material, model, image, audio, and standalone-shader handlers to the resource manager.

Release builds intentionally leave the manager without asset processors and must receive their complete resource store from BELD.

setup_default_window

fn setup_default_window(application: &mut super::GraphicsApplication)

Defined in crates/byte-engine/src/application/graphics/defaults.rs:131-136

Creates the 1920x1080 window used by the default headed setup.

process_default_window_input

fn process_default_window_input(input_system: &mut input::InputManager, event: ghi::window::Events) -> Option<(input::SeatHandle, input::DeviceHandle, input::input_manager::TriggerReference, input::Value)>

Defined in crates/byte-engine/src/application/graphics/integrations.rs:103-192

Converts GHI window events into records for the standard mouse and keyboard device classes.

setup_default_dmx

fn setup_default_dmx(application: &mut super::GraphicsApplication, receiver: crate::core::listener::DefaultListener<utils::RGBA>)

Defined in crates/byte-engine/src/application/graphics/integrations.rs:30-84

Starts an Art-Net worker that publishes received RGBA values as DMX output.

On this page