Skip to main content

Module gpu

Module gpu 

Source
Expand description

The GPU path (feature wgpu): scene tiles as half-float textures, drawn by an egui_wgpu paint callback whose shader runs the display transform’s Stage.

Experimental: may change in any release (docs/stability.md).

Call install once with the render state eframe (or a test harness) opened; from then on, viewports in that context send scene tiles here. Without it, everything takes the CPU path.

  • Textures are Rgba16Float where the adapter can sample it (else Rgba32Float), one per tile, a tile never larger than the device’s max_texture_dimension_2d.
  • Texels are read with textureLoad (nearest): below 100 % the source renders at the view’s scale, one texel per physical pixel; above, each image pixel is a crisp square.

Re-exports§

pub use egui_wgpu;

Structs§

GpuInfo
What install found.

Enums§

SurfacePolicy
Which surfaces a host may configure for a wanted target.

Functions§

choose_surface
The surface configuration path for a host that configures its own surface (eframe 0.36 configures 8-bit sRGB and offers no choice): the format and colour space to configure for wanted, among what the surface’s capabilities offer, and what the viewport will draw for once configured. Prefers what carries the wanted gamut and headroom, then fewer bits.
color_space
The display stage’s colour space for a wgpu one; Auto as wgpu resolves it (extended linear on half floats, sRGB otherwise).
install
Installs the GPU path on a render state; viewports in ctx use it from the next frame. Records what the surface expects for every window: eframe 0.36 configures rs.target_format with wgpu’s default colour space (8-bit sRGB in practice). A host that configured its surface itself calls install_for_surface.
install_for_surface
install, for a surface configured with space (and a display of headroom, 1.0 when unknown).
reads_fragment_storage
Whether an adapter with these downlevel flags and a device with these limits let the tile shader read a storage buffer in its fragment stage. WebGL 2 does not (no FRAGMENT_STORAGE, no storage buffer per stage): there, buffer device tiles are refused (DeviceTileError::BuffersUnsupported) and the buffer pipeline is not built.
render_device
The render device of the GPU path installed in ctx: the device a DeviceTile must be created on, and what it can read. None without a GPU path. Read when called: set by install at once, not at the next frame.
surface_format
The display stage’s surface format for a wgpu one.
surface_target
What a surface configured with format and space expects, as declared by wgpu’s window system integration; headroom is the display’s (wgpu’s DisplayHdrInfo), 1.0 when unknown.