docs: standardize shader file path to shader.wgsl
This commit is contained in:
@@ -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:
|
In wgpu, the shader source code lives as a Rust string, embedded at compile time:
|
||||||
|
|
||||||
```rust
|
```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).
|
`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).
|
||||||
|
|||||||
Reference in New Issue
Block a user