Module nannou::wgpu[][src]

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 DeviceExt::create_buffer_init 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.

util

Utility structures and functions.

Macros

vertex_attr_array

Macro to produce an array of VertexAttribute.

Structs

ActiveAdapter

A single active adapter and its map of connected devices.

Adapter

Handle to a physical graphics and/or compute device.

AdapterInfo

Information about an adapter.

AdapterMap

A map from RequestAdapterOptions to active adapters.

AdapterMapKey

The key into the adapter map.

BackendBit

Represents the backends that wgpu will use.

BindGroup

Handle to a binding group.

BindGroupBuilder

Simplified creation of a bind group.

BindGroupDescriptor

Describes a group of bindings and the resources to be bound.

BindGroupEntry

Bindable resource and the slot to bind it to.

BindGroupLayout

Handle to a binding group layout.

BindGroupLayoutBuilder

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

BindGroupLayoutDescriptor

Describes a BindGroupLayout.

BindGroupLayoutEntry

Describes a single binding inside a bind group.

BlendState

Describes the blend state of a pipeline.

Buffer

Handle to a GPU-accessible buffer.

BufferAsyncError

Error occurred when trying to async map a buffer.

BufferCopyViewBase

View of a buffer which can be used to copy to/from a texture.

BufferInitDescriptor

Describes a Buffer when allocating.

BufferSlice

Slice into a Buffer.

BufferUsage

Different ways that you can use a buffer.

BufferView

Read only view into a mapped buffer.

BufferViewMut

Write only view into mapped buffer.

Color

RGBA double precision color.

ColorTargetState

Describes the color state of a render pipeline.

ColorWrite

Color write mask. Disabled color channels will not be written to.

CommandBuffer

Handle to a command buffer on the GPU.

CommandBufferDescriptor

Describes a [CommandBuffer].

CommandEncoder

Encodes a series of GPU operations.

ComputePass

In-progress recording of a compute pass.

ComputePassDescriptor

Describes the attachments of a compute pass.

ComputePipeline

Handle to a compute pipeline.

ComputePipelineDescriptor

Describes a compute pipeline.

DepthBiasState

Describes the biasing setting for the depth target.

DepthStencilState

Describes the depth/stencil state in a render pipeline.

Device

Open connection to a graphics and/or compute device.

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.

Extent3d

Extent of a texture related operation.

Features

Features that are not guaranteed to be supported.

FragmentState

Describes the fragment process in a render pipeline.

ImageHolder

Workaround for the fact that image::SubImage requires a Deref impl on the wrapped image.

ImageReadMapping

A wrapper around a slice of bytes representing an image.

Instance

Context for all other wgpu objects. Instance of wgpu.

Limits

Represents the sets of limits an adapter/device supports.

MultisampleState

Describes the multi-sampling state of a render pipeline.

Operations

Pair of load and store operations for an attachment aspect.

Origin3d

Origin of a copy to/from a texture.

PipelineLayout

Handle to a pipeline layout.

PipelineLayoutDescriptor

Describes a pipeline layout.

PipelineStatisticsTypes

Flags for which pipeline data should be recorded.

PrimitiveState

Describes the state of primitive assembly and rasterization in a render pipeline.

PushConstantRange

A range of push constant memory to pass to a shader stage.

QuerySet

Handle to a query set.

QuerySetDescriptor

Describes how to create a QuerySet.

Queue

Handle to a command queue on a device.

RenderBundle

Pre-prepared reusable bundle of GPU operations.

RenderBundleEncoder

Encodes a series of GPU operations into a reusable “render bundle”.

RenderBundleEncoderDescriptor

Describes a RenderBundleEncoder.

RenderPass

In-progress recording of a render pass.

RenderPassBuilder

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

RenderPassColorAttachmentDescriptor

Describes a color attachment to a RenderPass.

RenderPassColorAttachmentDescriptorBuilder

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

RenderPassDepthStencilAttachmentDescriptor

Describes a depth/stencil attachment to a RenderPass.

RenderPassDescriptor

Describes the attachments of a render pass.

RenderPipeline

Handle to a rendering (graphics) pipeline.

RenderPipelineBuilder

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

RenderPipelineDescriptor

Describes a render (graphics) pipeline.

RequestAdapterOptionsBase

Options for requesting adapter.

RequestDeviceError

Requesting a device failed.

RowPaddedBuffer

A wrapper around a wgpu buffer suitable for copying to and from Textures. Automatically handles the padding necessary for buffer-to-texture and texture-to-buffer copies.

Sampler

Handle to a sampler.

SamplerBuilder

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

SamplerDescriptor

Describes a Sampler

ShaderFlags

Flags controlling the shader processing.

ShaderModule

Handle to a compiled shader module.

ShaderModuleDescriptor

Descriptor for a shader module.

ShaderStage

Describes the shader stages that a binding will be visible from.

StencilFaceState

Describes stencil state in a render pipeline.

StencilState

State of the stencil operation (fixed-pipeline stage).

Surface

Handle to a presentable surface.

SwapChain

Handle to a swap chain.

SwapChainDescriptor

Describes a [SwapChain].

SwapChainFrame

Result of a successful call to SwapChain::get_current_frame.

SwapChainTexture

Swap chain image that can be rendered to.

Textue5cfe74reSnapshot

A snapshot captured by a Capturer.

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.

TextureCopyViewBase

View of a texture which can be used to copy to/from a buffer/texture.

TextureDataLayout

Layout of a texture in a buffer’s memory.

TextureHandle

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.

TextureUsage

Different ways that you can use a texture.

TextureView

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

TextureViewDescriptor

Describes a TextureView.

TextureViewHandle

Handle to a texture view.

TextureViewId

A unique identifier associated with a TextureView.

VertexAttribute

Vertex inputs (attributes) to shaders.

VertexBufferLayout

Describes how the vertex buffer is interpreted.

VertexState

Describes the vertex process in a render pipeline.

Enums

AddressMode

How edges should be handled in texture addressing.

Backend

Backends supported by wgpu.

BindingResource

Resource that can be bound to a pipeline.

BindingType

Specific type of a binding.

BlendFactor

Alpha blend factor.

BlendOperation

Alpha blend operation.

BufferBindingType

Specific type of a buffer binding.

CompareFunction

Comparison function used for depth and stencil operations.

CullMode

Type of faces to be culled.

DeviceType

Supported physical device types.

Error

Error type

FilterMode

Texel mixing mode when sampling between texels.

FrontFace

Winding order which classifies the “front” face.

IndexFormat

Format of indices used with pipeline.

InputStepMode

Rate that determines when vertex data is advanced.

LoadOp

Operation to perform to the output attachment at the start of a renderpass.

Maintain

Passed to Device::poll to control if it should block or not. This has no effect on the web.

MapMode

Type of buffer mapping.

PolygonMode

Type of drawing mode for polygons

PowerPreference

Power Preference when choosing a physical adapter.

PresentMode

Behavior of the presentation engine based on frame rate.

PrimitiveTopology

Primitive type the input mesh is composed of.

QueryType

Type of query contained in a QuerySet.

SamplerBorderColor

Color variation to use when sampler addressing mode is AddressMode::ClampToBorder

ShaderSource

Source of a shader module.

StencilOperation

Operation to perform on the stencil value.

StorageTextureAccess

Specific type of a sample in a texture binding.

SwapChainError

Result of an unsuccessful call to SwapChain::get_current_frame.

SwapChainStatus

Status of the recieved swapchain image.

TextureAspect

Kind of data the texture holds.

TextureDimension

Dimensionality of a texture.

TextureFormat

Underlying texture data format.

TextureSampleType

Specific type of a sample in a texture binding.

TextureViewDimension

Dimensions of a particular texture view.

VertexFormat

Vertex Format for a Vertex Attribute (input).

Constants

BIND_BUFFER_ALIGNMENT

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

COPY_BUFFER_ALIGNMENT

Buffer to buffer copy offsets and sizes must be aligned to this number.

COPY_BYTES_PER_ROW_ALIGNMENT

Buffer-Texture copies must have bytes_per_row aligned to this number.

DEFAULT_BACKENDS

Nannou’s default WGPU backend preferences.

DEFAULT_POWER_PREFERENCE

The default power preference used for requesting the WGPU adapter.

PUSH_CONSTANT_ALIGNMENT

Alignment all push constants need

Traits

ToTextureView

Types that can produce a texture view.

UncapturedErrorHandler

Type for the callback of uncaptured error handler

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.

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_filtering

Whether or not the sampler descriptor describes a sampler that might perform linear filtering.

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.

Type Definitions

BufferAddress

Integral type used for buffer offsets.

BufferCopyView

View of a buffer which can be used to copy to/from a texture.

BufferDescriptor

Describes a Buffer.

BufferSize

Integral type used for buffer slice sizes.

CommandEncoderDescriptor

Describes a CommandEncoder.

DeviceDescriptor

Describes a Device.

DynamicOffset

Integral type used for dynamic bind group offsets.

Label

Object label.

RenderBundleDescriptor

Describes a RenderBundle.

RequestAdapterOptions

Additional information required when requesting an adapter.

ShaderLocation

Integral type used for binding locations in shaders.

TextureCopyView

View of a texture which can be used to copy to/from a buffer/texture.

TextureDescriptor

Describes a Texture.