[][src]Module nannou::wgpu

Items related to wgpu and its integration in nannou!

WebGPU is the portable graphics specification that nannou targets allowing us to write code that is both fast and allows us to target a wide range of platforms. wgpu is the name of the crate we use that implements this specification.

This module re-exports the entire wgpu crate along with all of its documentation while also adding some additional items that makes wgpu easier to use alongside nannou.

Useful links:

Modules

blend

A set of useful descriptors for blending colours!

bytes

The functions within this module use unsafe in order to retrieve their input as a slice of bytes. This is necessary in order to upload data to the GPU via the wgpu create_buffer_with_data buffer constructor. This method is unsafe as the type T may contain padding which is considered to be uninitialised memory in Rust and may potentially lead to undefined behaviour.

Macros

vertex_attr_array

Macro to produce an array of [VertexAttributeDescriptor]

vertex_format_size

Structs

ActiveAdapter

A single active adapter and its map of connected devices.

Adapter

A handle to a physical graphics and/or compute device.

AdapterInfo

Metadata about a backend adapter.

AdapterMap

A map from RequestAdapterOptions to active adapters.

AdapterMapKey

The key into the adapter map.

BackendBit
BindGroup

An opaque handle to a binding group.

BindGroupBuilder

Simplified creation of a bind group.

BindGroupDescriptor

A description of a group of bindings and the resources to be bound.

BindGroupLayout

An opaque handle to a binding group layout.

BindGroupLayoutBuilder

A type aimed at simplifying the creation of a bind group layout.

BindGroupLayoutDescriptor

A description of a bind group layout.

BindGroupLayoutEntry

A description of a single binding inside a bind group.

Binding

A bindable resource and the slot to bind it to.

BlendDescriptor
Buffer

A handle to a GPU-accessible buffer.

BufferAsyncErr
BufferBytes

A wrapper around a wgpu::Buffer containing bytes of a known length.

BufferCopyView

A view of a buffer which can be used to copy to or from a texture.

BufferDescriptor

A description of a buffer.

BufferImage

A wrapper around a wgpu buffer that contains an image of a known size and image::ColorType.

BufferReadMapping
BufferUsage
BufferWriteMapping
Color
ColorStateDescriptor
ColorWrite
CommandBuffer

An opaque handle to a command buffer on the GPU.

CommandBufferDescriptor
CommandEncoder

An object that encodes GPU operations.

CommandEncoderDescriptor

A description of a command encoder.

ComputePass

An in-progress recording of a compute pass.

ComputePipeline

A handle to a compute pipeline.

ComputePipelineDescriptor

A complete description of a compute pipeline.

CreateBufferMapped

A buffer being created, mapped in host memory.

DepthStencilStateDescriptor
Device

An open connection to a graphics and/or compute device.

DeviceDescriptor
DeviceMap

A map of actively connected devices for an adapter.

DeviceMapKey

The key into the device map.

DeviceQueuePair

A handle to a connected logical device and its associated queue.

Extensions
Extent3d
ImageReadMapping

A wrapper around a slice of bytes representing an image.

Limits
Origin3d
PipelineLayout

An opaque handle to a pipeline layout.

PipelineLayoutDescriptor

A description of a pipeline layout.

ProgrammableStageDescriptor

A description of a programmable pipeline stage.

Queue

A handle to a command queue on a device.

RasterizationStateDescriptor
RenderPass

An in-progress recording of a render pass.

RenderPassBuilder

A builder type to simplify the process of creating a render pass descriptor.

RenderPassColorAttachmentDescriptorBuilder

A builder type to simplify the process of creating a render pass descriptor.

RenderPassDescriptor

A description of all the attachments of a render pass.

RenderPipeline

A handle to a rendering (graphics) pipeline.

RenderPipelineBuilder

A builder type to help simplify the construction of a RenderPipeline.

RenderPipelineDescriptor

A complete description of a render (graphics) pipeline.

RequestAdapterOptions

Options for requesting adapter.

Rgba8ReadMapping

A wrapper around a slice of bytes representing a non-linear sRGBA image.

Sampler

A handle to a sampler.

SamplerBuilder

Simplifies the construction of a Sampler with a set of reasonable defaults.

SamplerDescriptor
ShaderModule

A handle to a compiled shader module.

ShaderStage
StencilStateFaceDescriptor
Surface

A handle to a presentable surface.

SwapChain

A handle to a swap chain.

SwapChainDescriptor
SwapChainOutput

A swap chain image that can be rendered to.

Texture

A convenient wrapper around a handle to a texture on the GPU along with its descriptor.

TextureBuilder

A type aimed at simplifying the construction of a Texture.

TextureCapturer

A type dedicated to capturing a texture as a non-linear sRGBA image that can be read on the CPU.

TextureCapturerAwaitWorkerTimeout

An error indicating that the threadpool timed out while waiting for a worker to become available.

TextureCopyView

A view of a texture which can be used to copy to or from a buffer or another texture.

TextureDescriptor

A description of a texture.

TextureHandle

A handle to a texture on the GPU.

TextureId

A unique identifier associated with a Texture.

TextureReshaper

Reshapes a texture from its original size, sample_count and format to the destination size, sample_count and format.

TextureSnapshot

A snapshot captured by a Capturer.

TextureUsage
TextureView

A convenient wrapper around a handle to a texture view along with its descriptor.

TextureViewDescriptor
TextureViewHandle

A handle to a texture view.

TextureViewId

A unique identifier associated with a TextureView.

TimeOut

The GPU timed out when attempting to acquire the next texture or if a previous output is still alive.

VertexAttributeDescriptor
VertexBufferDescriptor

A description of a vertex buffer.

VertexStateDescriptor

The vertex input state for a render pipeline.

Enums

AddressMode
Backend
BindingResource

A resource that can be bound to a pipeline.

BindingType

Specific type of a binding..

BlendFactor
BlendOperation
CompareFunction
CullMode
DeviceType

Supported physical device types

FilterMode
FrontFace
IndexFormat
InputStepMode
LoadOp
Maintain

This is passed to Device::poll to control whether it should block or not.

PowerPreference
PresentMode
PrimitiveTopology
StencilOperation
StoreOp
TextureAspect
TextureComponentType
TextureDimension
TextureFormat
TextureViewDimension
VertexFormat

Constants

BIND_BUFFER_ALIGNMENT

Bound uniform/storage buffer offsets must be aligned to this number.

DEFAULT_BACKENDS

Nannou's default WGPU backend preferences.

DEFAULT_EXTENSIONS

The default set of Extensions used within the default_device_descriptor() function.

DEFAULT_POWER_PREFERENCE

The default power preference used for requesting the WGPU adapter.

MAX_BIND_GROUPS

Traits

ToTextureView

Types that can produce a texture view.

Functions

clear_texture

Adds a simple render pass command to the given encoder that simply clears the given texture with the given colour.

create_pipeline_layout

Shorthand for creating the pipeline layout from a slice of bind group layouts.

default_device_descriptor

The default device descriptor used to instantiate a logical device when creating windows.

extent_3d_eq

Returns true if the given wgpu::Extent3ds are equal.

read_spirv
resolve_texture

Adds a simple render pass command to the given encoder that resolves the given multisampled src_texture to the given non-multisampled dst_texture.

sampler_descriptor_clone

TODO: Remove this once derive(Clone) is added to wgpu SamplerDescriptor.

shader_from_spirv_bytes
texture_descriptor_eq

Returns true if the given texture descriptors are equal.

texture_format_from_image_color_type

Convert the given color type from the image crate to the corresponding wgpu texture format.

texture_format_size_bytes

Return the size of the given texture format in bytes.

texture_format_to_component_type

The component type associated with the given texture format.

Type Definitions

BufferAddress
DynamicOffset
RenderPassColorAttachmentDescriptor
RenderPassDepthStencilAttachmentDescriptor
ShaderLocation