Expand description
§simple-wgpu
An opinionated wrapper around wgpu-rs, that aims to improve the API ergonomics and avoid ongoing issues with rust lifetimes.
I’m a big fan of the write-once-cross-compile-anywhere promise underlying WebGPU, but I’m less of a fan of the API itself. The WebGPU API is modelled on an earlier, pipeline-centric vision of the Vulkan API, and has inherited a degree of verbosity/inflexibility as a result. This library aims to recapture some of the simplicity of writing code for OpenGL - ideally without giving up the safety and stability guarantees of wgpu-rs.
§Goals
- Reduce the combinatorial pipeline explosion, along the lines of VK_EXT_extended_dynamic_state
- Workaround lifetime limitations while recording render passes in the wgpu-rs rust API
- Improve DRY (Don’t Repeat Yourself) by eliminating the duplicate specification in bind group/pipeline layout objects
§Non-goals
- Performance. I don’t want this wrapper to be slow, but where necessary I will trade performance for ergonomics.
- API Stability (for now). I’m actively iterating on where the boundary between dynamic and baked state should be, as well as whether the more object-oriented wrappers make sense.
§Who is it for?
Me, mostly, but if you find it useful, feel free.
§License
I’ve put this under the Apache license, but if you need a more permissive license, feel free to get in touch.
Structs§
- Bind
Group - A handle to a binding group
- Bind
Group Builder - Builds a BindGroup
- Buffer
- A handle to a GPU buffer
- Buffer
Binding - How to bind a Buffer to a BindGroup
- Buffer
Slice - A sub-slice of a Buffer
- Color
Attachment - A color attachment for a RenderPass
- Color
Target State - Sets blend modes and color masks for a render target
- Command
Encoder - Encodes a series of GPU operations
- Compute
Pass - Record a compute pass
- Compute
Pipeline - A compute pipeline
- Compute
Pipeline Builder - Builds a ComputePipeline
- Context
- Wraps the wgpu Device and Queue, and caches all of the wgpu resource types
- Depth
Stencil Attachment - A depth/stencil attachment for a RenderPass
- Dispatch
- All of the data needed to issue a single compute operation
- Draw
Call - All of the data needed to issue a single draw call
- Entry
Point - A handle to a compiled shader with a specific main function
- Rasteriser
State - The set of rendering state that is convenient to vary on a per-draw basis
- Render
Pass - Record a render pass
- Render
Pipeline - A render pipeline
- Render
Pipeline Builder - Builds a RenderPipeline
- Render
Texture - A texture that can be used as a render pass attachment
- Sampler
- A texture sampler
- Sampler
Builder - Builds a Sampler
- Shader
- A handle to a compiled shader
- Texture
- A handle to a GPU texture
- Texture
Binding - How to bind a Texture to a BindGroup
- Vertex
Buffer Layout - Describes the layout of a vertex buffer