Skip to main content

Crate mln_gfx

Crate mln_gfx 

Source
Expand description

The backend-independent graphics layer: the gpu::Gpu interface a backend implements, and the renderer data drawn through it. mln_webgpu implements it on wgpu, mln_mtl on Metal, mln_vulkan on Vulkan and mln_gl on OpenGL ES 3.0.

A backend’s RendererBackend owns its Gpu and lends it, to the renderer and to the FrameTarget that the renderer draws into; the Gpu owns the renderer’s buffers, textures and the groups of buffers its draws bind, which the renderer keeps in mln_engine. The targets that draw into rings of the host’s textures, or of images they export, are generic over each backend’s part, in ring. What each program reads, and the text it compiles from, is in shaders::program; the renderer declares the programs.

gfx and the backends log through tracing, as the rest of the library does, under targets that name the event: <crate>::render for devices, frames and presenting, and <crate>::graphics_backend for the calls of a graphics API’s platform layer, such as EGL’s or WGL’s.

Re-exports§

pub use color_mode::ColorMode;
pub use color_mode::Rgba;
pub use cull_face_mode::CullFaceMode;
pub use depth_mode::DepthMode;
pub use draw_mode::DrawMode;
pub use error::Error;
pub use error::ErrorKind;
pub use export::DepthStencilFormat;
pub use export::DepthStencilFormats;
pub use export::DmaBufFormat;
pub use export::DmaBufPlane;
pub use export::ExportKind;
pub use export::ExportKinds;
pub use export::ExportedFrame;
pub use export::ExportedImage;
pub use export::ExportedRing;
pub use export::FrameDepth;
pub use export::NativeTexture;
pub use frame::ConsumerSync;
pub use frame::FrameImage;
pub use frame::FramePixels;
pub use frame::FrameTarget;
pub use frame::GpuSync;
pub use frame::Handoff;
pub use frame::SyncKind;
pub use frame::SyncKinds;
pub use gfx_types::AttributeDataType;
pub use gfx_types::DrawModeType;
pub use gfx_types::PrimitiveType;
pub use renderer_backend::RendererBackend;
pub use stencil_mode::StencilMode;
pub use types::DepthMaskType;
pub use window::Window;

Modules§

backend
color_mode
cull_face_mode
depth_mode
draw_mode
error
The error of the calls that make devices and render targets.
export
Rings of images that a target allocates and shares with the host: the ways a texture’s memory crosses to another API or process, how a ring picks one of those that the host imports, and what each frame hands over.
frame
How a frame is drawn into a target: the target begins the frame, the renderer draws into the textures the target gives it and submits them, and the target ends the frame, which hands the image off. Each step takes the backend’s Gpu, which the caller lends to all three.
gfx_types
gpu
The interface a GPU backend implements: resources the backend owns and the caller names by id, objects prepared from them, and draws.
offscreen_target
Frames drawn into textures of the library’s and read back, which headless rendering and render tests draw into.
projection_variant
renderer_backend
rendering_stats
ring
Ring targets: a BorrowedTarget draws frames into a ring of the host’s textures and gives each back, and an ExportedTarget draws into a ring of images of its own, which it exports, through a borrowed target over each generation of them.
shaders
The backend-independent shader code: what a program reads and the text its shaders compile from, uniform blocks, and the binding ids and defines. The renderer declares the programs.
stencil_mode
texture2d
How the renderer’s textures are sampled, and the formats they have.
types
util_hash
The hash maps of gfx and the backends, and the combination of hashes that their cache keys use.
window
The windows that window targets present to.

Macros§

uniform_block
Declares a uniform block: a #[repr(C, align(16))] struct, Pod and Default, whose fields are its members, and its UniformBlock layout.

Structs§

Size
A width and height in pixels: of a frame, a render target or a texture.