Skip to main content

Crate noesis_wgpu

Crate noesis_wgpu 

Source
Expand description

A wgpu render device for the Noesis GUI Native SDK.

Noesis does no drawing of its own: it hands a render device textures to create, render targets to fill, and batches of triangles to draw. WgpuRenderDevice does that work on a wgpu::Device and wgpu::Queue you provide. It compiles a pipeline for each shader and render state Noesis asks for, and submits its own command encoders: one when the offscreen phase ends and one when the onscreen phase ends.

The device renders into Rgba8Unorm targets. Use it from the thread that drives the Noesis view and renderer.

§Driving the device

With the default shim feature, the device implements noesis_runtime’s RenderDevice trait. Register it with noesis_runtime::render_device::register, bind it to a view’s renderer, and Noesis calls it directly:

ⓘ
let mut device = noesis_wgpu::WgpuRenderDevice::new(wgpu_device, wgpu_queue);
device.set_onscreen_target(target_view, width, height);
let registered = noesis_runtime::render_device::register(device);
view.renderer().init(&registered);

A host that receives Noesis’s device calls some other way, such as a C# RenderDevice that forwards them over a C ABI, calls the same methods itself. That host creates Noesis’s texture objects, so it knows which TextureHandle each texture pointer in a Batch stands for. It passes them to WgpuRenderDevice::draw_batch_with as BatchTextures.

§Beyond the protocol

§Features

  • shim (default): implements noesis_runtime’s RenderDevice trait and BatchTextures::from_batch. Turns on noesis_runtime’s own shim feature, so the build needs the Noesis Native SDK. Without it, this crate and noesis_runtime build with no SDK and link no Noesis library.

Structs§

BatchShader
The custom shader a batch draws with, and its inputs, as device handles.
BatchTextures
The textures a Batch samples, as device handles.
DeviceStats
What a WgpuRenderDevice has drawn, from WgpuRenderDevice::stats.
PatternLod
How pattern textures pick their mip level, set with WgpuRenderDevice::set_pattern_lod.
PixelShaderDesc
Parameters for WgpuRenderDevice::create_pixel_shader.
PixelShaderError
Why WgpuRenderDevice::create_pixel_shader rejected a shader: the description is out of range, or wgpu’s validation message for the WGSL.
PixelShaderHandle
The device’s identifier for a custom pixel shader, returned by WgpuRenderDevice::create_pixel_shader.
WgpuRenderDevice
A Noesis render device that draws with wgpu.

Enums§

PixelShaderKind
Which Noesis object a custom shader serves, which decides the function its source defines and the batches it draws.

Constants§

MAX_SHADER_CONSTANTS
The largest Constants struct a custom shader can declare, in bytes: the size of Noesis’s cbuffer1_ps, 128 floats.
MAX_SHADER_TEXTURES
The most extra textures a custom shader can sample.