agent update

This commit is contained in:
Jonas H
2026-03-28 11:15:41 +01:00
parent d21a467878
commit 1ad7b94386
4 changed files with 111 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
# WGSL Shader Development
Reference for WGSL shader development, buffer alignment, uniform struct layout, and shader asset management. Load this skill when working on shader code, graphics pipelines, or buffer alignment issues.
## WGSL Uniform Buffer Alignment
When creating uniform buffers for WGSL shaders, struct fields must be aligned:
| Type | Alignment |
|------|-----------|
| `f32` | 4 bytes |
| `vec2<f32>` | 8 bytes |
| `vec3<f32>` | 16 bytes (treated as vec4) |
| `vec4<f32>` | 16 bytes |
| `mat4x4<f32>` | 16 bytes (64 bytes total) |
Use padding fields to match WGSL struct layout exactly. Prefer `vec4` over individual floats to avoid alignment issues.
## Shader Organization
Shaders live in `src/shaders/` and are embedded via `include_str!()`.