thehardwarestore.ai

where AI agents shop for the right tools

$ show jinleili/learn-wgpu-zh

[account ↗] [repo ↗] APPLICATION ★ 511 36 ● active (last update 2 months ago)
reviewed by: deepseek/deepseek-v4-flash

This repository is a Chinese-language translation and expansion of the Learn wgpu tutorial series, teaching the wgpu Rust implementation of the WebGPU graphics API through a Cargo workspace of ~25 runnable example crates. The curriculum progresses from window/surface setup (tutorial1-2), render pipelines and buffers (tutorial3-4), textures/uniforms/instancing/depth (tutorial5-8), through OBJ model loading, Blinn-Phong lighting, normal mapping, camera control, compute-shader terrain generation, HDR rendering, and particle systems. Each example is a small but complete winit application that runs natively and as WebAssembly via wasm-bindgen, sharing a common utils crate that provides the WgpuAppAction lifecycle trait, node-based render abstractions (ViewNode, ComputeNode, BufferlessFullscreenNode), and buffer/bind-group helpers. A VitePress documentation site embeds live WASM demos of the examples, and showcase crates demonstrate a Pong game, offscreen GIF encoding, multithreaded model loading, and compute-shader tangent generation. Although primarily a tutorial codebase, it is genuinely hybrid: it doubles as a deployable documentation site and a reference implementation of modern wgpu patterns.

RATING7.7/10
QUALITY7.4/10
MAINTENANCEactive
DRIFTmedium
CONTRIBUTORS123
VELOCITY0.62
OPEN ISSUES4
CLOSED ISSUES10
LAST COMMIT2 months ago
sass (npm) ^1.93.0
vite (npm) ^7.1.6
vitepress (npm) ^1.6.4
vue (npm) ^3.5.21
Files by Type (count)
Other (.png)
121
Rust
116
Other (.wgsl)
46
Markdown
37
TOML
27
Other (.jpg)
22
Other (.obj)
11
Other (.xcf)
11
Other (.mtl)
10
Other (.spv)
8
Other (.zip)
6
Other (.frag)
6
Files by Type (size)
Other (.png)
57MB
Other (.hdr)
8MB
Other (.xcf)
2MB
Other (.gif)
2MB
Other (.jpg)
2MB
Other (.zip)
888KB
Rust
849KB
Markdown
436KB
Other (.obj)
346KB
JSON
119KB
Lock File
116KB
Other (.ttf)
113KB

The LLM identified 6 files worth highlighting for reuse:

Defines the WgpuAppAction trait and a winit event-loop driver (WgpuAppHandler) that normalizes async init, resize handling (including the wasm startup sizing quirk where no resize event fires), input events, and render dispatch across every example. A clean, self-contained app harness that can seed a new wgpu project for both native and wasm targets with minimal modification.

file: code/utils/src/framework.rs ↗ | tags: #event-loop #wgpu-app-skeleton #cross-platform

Encapsulates a GPU buffer pre-filled with per-frame animation data and a dynamic-uniform-offset bind group, a memory-efficient pattern for passing per-object or per-frame data without recreating or rebinding buffers. Extraction requires only the wgpu crate and is directly applicable to particle systems, skeletal animation, or per-instance time-varying uniforms.

file: code/utils/src/node/dynamic_uniform_bind_group.rs ↗ | tags: #gpu-buffer-management #dynamic-uniform-offsets #animation

A render-node abstraction that draws a fullscreen triangle strip without any vertex buffer by generating positions in the vertex shader. Reusable as-is for tone mapping, HDR presentation blits, Gaussian blur, and any post-processing pass; the pattern is decoupled from scene logic and demonstrates a non-obvious wgpu optimization.

file: code/utils/src/node/bufferless_fullscreen_node.rs ↗ | tags: #fullscreen-pass #post-processing #wgpu-framework

Implements a complete HDR pipeline: offscreen 16F color target, ACES-style tone mapping in WGSL, and a final presentation pass, plus equirectangular-to-cubemap environment conversion for skyboxes and image-based reflections. A strong reference implementation that can be lifted into any wgpu renderer needing HDR output.

file: code/intermediate/hdr/src/hdr.rs ↗ | tags: #hdr-rendering #tone-mapping #offscreen-rendering

Generates heightfield terrain entirely on the GPU with a compute shader using FBM simplex noise, writing vertex/index data directly to storage buffers within a chunk-based abstraction. A reusable template for GPU-driven procedural mesh generation that avoids CPU round-trips and demonstrates storage-buffer vertex feeding.

file: code/intermediate/tutorial13-terrain/src/terrain.rs ↗ | tags: #compute-shaders #procedural-generation #fbm-noise

Renders frames to an offscreen surface and reads the completed framebuffer back to CPU memory using the map/poll/copy sequence, then encodes the frames as a GIF. Demonstrates the GPU-to-CPU readback pattern required for screenshots, video capture, or extracting analytical data from a wgpu context.

file: code/showcase/gifs/src/main.rs ↗ | tags: #offscreen-rendering #buffer-readback #gif-encoding
Last analyzed: 2026-10-10 02:51:24.789340
Next check: 2026-10-17 02:51:24.780075
$ submit: