Skip to main content

oxiui_render_wgpu/
gpu.rs

1//! Real (non-stub) headless GPU rendering for OxiUI, built on [`wgpu`].
2//!
3//! This module implements [`oxiui_core::paint::RenderBackend`] on a GPU target
4//! that is created *headlessly* — there is no window or swap-chain surface.
5//! Draw commands are rasterised into an offscreen colour texture which can be
6//! read back to CPU memory for testing or off-screen export.
7//!
8//! Sub-modules:
9//!
10//! - [`device`]        — headless `Instance`/adapter/device/queue + offscreen texture.
11//! - [`pipeline`]      — `solid.wgsl`, `gradient.wgsl`, `textured.wgsl`, `blur.wgsl`,
12//!   and `composite.wgsl` compiled pipelines.
13//! - [`buffer`]        — `#[repr(C)]` `Pod` vertex / uniform layouts + quad emitters.
14//! - [`tessellator`]   — CPU path flattening and stroke/fill tessellation.
15//! - [`texture`]       — image upload utilities and `TexturedDraw`.
16//! - [`shadow`]        — ping-pong Gaussian blur + composite for `BoxShadow`.
17//! - [`geometry`]      — CPU geometry builder, visibility culling helpers, and
18//!   draw-segment / gradient-draw data structures.
19//! - [`exec`]          — GPU pass execution helpers and [`FrameStats`].
20//! - [`renderer`]      — [`WgpuBackend`] and the `RenderBackend` implementation.
21//! - [`instance`]      — instanced rectangle rendering pipeline and renderer.
22//! - [`render_target`] — off-screen render targets for cached subtrees.
23//! - [`layer_cache`]   — GPU-backed render-layer cache with dirty tracking.
24//! - [`ring_buffer`]   — streaming vertex/index ring buffer.
25
26pub mod blend;
27pub mod buffer;
28pub mod compute_blur;
29pub mod device;
30pub mod earcut;
31pub mod exec;
32pub mod frame_pacing;
33pub mod geometry;
34pub mod hdr;
35pub mod instance;
36pub mod layer_cache;
37pub mod pipeline;
38pub mod render_target;
39pub mod renderer;
40pub mod ring_buffer;
41pub mod shadow;
42pub mod stencil;
43pub mod tessellator;
44pub mod texture;
45
46pub use blend::{blend_state_for_mode, BlendPipelineSet};
47pub use buffer::{Globals, GradientVertex, TexVertex, Vertex};
48pub use compute_blur::ComputeBlurPipeline;
49pub use device::{GpuContext, TARGET_FORMAT};
50pub use exec::FrameStats;
51pub use frame_pacing::{FrameHistogram, FrameTimer, FrameTimerMode, PresentModeRecommendation};
52pub use hdr::{select_surface_format, HdrGpuContext, SurfaceColorFormat, HDR_FORMAT};
53pub use instance::{InstanceRect, InstancedRectPipeline, InstancedRectRenderer};
54pub use layer_cache::LayerCache;
55pub use pipeline::{
56    BlurPipeline, CompositePipeline, GradientPipeline, SolidPipeline, TexturedPipeline,
57};
58pub use render_target::RenderTarget;
59pub use renderer::WgpuBackend;
60pub use ring_buffer::{RingAllocation, RingBuffer, RingBufferStats};
61pub use stencil::{StencilClipState, StencilTarget, StencilWritePipeline, DEPTH_STENCIL_FORMAT};