Skip to main content

Crate cranpose_render_wgpu

Crate cranpose_render_wgpu 

Source
Expand description

§Cranpose WGPU Renderer

cranpose-render-wgpu produces Cranpose scene output with wgpu. Platform-shell authors connect the renderer to a device, queue and surface. App authors usually select a renderer feature on cranpose and use AppLauncher.

WgpuRenderer::new accepts app font data. The host then supplies the WGPU device, queue and surface format:

use cranpose_render_wgpu::WgpuRenderer;

static APP_FONTS: &[&[u8]] = &[];
let renderer = WgpuRenderer::new(APP_FONTS);

Platform-shell authors call init_gpu and the render methods for GPU setup and frame presentation. The desktop shell and web shell show platform setup and surface presentation.

Default features are empty. backend-gles adds the GL-class backend on native targets. Web builds include the WebGL fallback. The optional embedded-default-font feature supplies the framework fallback font. App projects select WGPU with the renderer-wgpu feature on cranpose; the renderer-wgpu-gles feature also enables backend-gles for native builds.

See the WgpuRenderer API, the renderer architecture guide, the feature list and the crate source.

Modules§

pipeline_disk_cache

Structs§

CapturedFrame
CPU-readable RGBA frame captured from the renderer output.
DebugToggle
A debug toggle cached until an override changes. Unset values can be read without acquiring the cache lock.
GpuPassTimingEntry
One label’s aggregate inside the current print window.
GpuPassTimingReport
GPU time by pass label, aggregated since the last [GPU-PASS] print. Check the invalid and dropped counters before comparing workloads; rejected frames contribute neither time nor passes to this report.
HitRegion
PresentTimings
Present-stage timestamps for one consumed packet, in nanoseconds on the clock the producer injected at runtime start (0 = stage did not run or no clock was injected). Carried back in RenderReturns so the producer’s frame telemetry keeps recording acquire/render/present phases after those stages move to the present thread. Plain integers so the packet types stay clock-library-free on every target.
RenderStatsSnapshot
Scene
WgpuRenderer
WGPU-based renderer for GPU-accelerated 2D rendering.
WgpuTextSystem

Enums§

PublishOutcome
What WgpuRenderer::publish_frame did.
WgpuRendererError

Constants§

COMPOSITION_BYTES_PER_PIXEL
Bytes one pixel of a composition target holds: every renderer composites in an 8-bit format.

Traits§

PresentObserver
Platform code the present thread runs around every present to a surface, for what only the platform can do with its swapchain, such as asking the display when earlier frames reached the screen.

Functions§

clear_to_background
Clears view to color and submits the work, through the same WgpuFrameGraph every other command encoder and submission in this crate is required to go through (enforced by render_contract.rs’s wgpu_command_buffers_are_owned_by_frame_graph_executor) — a fresh, one-shot WgpuFrameGraphExecutor, since a placeholder clear has no frame-to-frame state worth pooling. Does not present or acquire anything itself — callers that mean to show the clear on screen still acquire a frame and call wgpu::SurfaceTexture::present themselves, exactly as a real content frame would.
clear_to_default_background
Clears view to the framework’s default background; see clear_to_background.
frame_clear_color
What a frame clears to before it draws: nothing for a transparent window, the framework’s background for every other surface.
frames_presented
headless_text_measurer
Create an accurate WGPU text measurer for headless tests without launching a window.
headless_text_measurer_with_fonts
Create an accurate WGPU text measurer for headless tests with explicit fonts.
optional_device_features
The optional device features the renderer exploits when the adapter offers them: pipeline caching (see pipeline_disk_cache), the timestamp queries behind CRANPOSE_GPU_PASS_TIMING, and, on a GPU that shares the host’s memory, vertex and uniform buffers the CPU writes directly, so a frame’s uploads need no copy. Every platform’s request_device passes this so a profiling toggle never needs a rebuilt binary; intersecting with the adapter’s own features keeps the request valid on adapters without them.
pin_current_thread_to_fast_cores
Restricts the calling thread to the fast-capacity CPUs, when the machine has distinguishable ones. role names the thread in the log line so an A/B trace shows who pinned where.
pipelines_created
pipelines_created_off_frame
Pipelines built away from every frame, on the compiler thread.
presentable_root_usages
The usages to ask of a presentable image: rendering, and whichever of the copies and sampling the surface offers. Sampling lets a frame whose backdrops read the page draw straight into the image too.