docs: standardize shader file path to shader.wgsl

This commit is contained in:
2026-05-30 20:20:53 -05:00
parent 9051de0591
commit 8ee04f9dce

View File

@@ -128,7 +128,7 @@ fn fs_main(input: VertexOutput) -> @location(0) vec4<f32> {
In wgpu, the shader source code lives as a Rust string, embedded at compile time:
```rust
const SHADER_SOURCE: &str = include_str!("shaders/main.wgsl");
const SHADER_SOURCE: &str = include_str!("shader.wgsl");
```
`include_str!` reads the WGSL file during Rust compilation and inlines it as a `&'static str`. There is no runtime file I/O. The shader text is part of the binary. When you create the shader module via `device.create_shader_module()`, wgpu compiles the string to the platform's GPU intermediate format (SPIR-V, MSL, or DXIL). The compilation happens asynchronously on the [[device]](GLOSSARY.md#device) — you drive it to completion with a [[device poll]](GLOSSARY.md#device-poll).