book: add section for workgroup memory (#713)

This commit is contained in:
Markus Siglreithmaier 2021-08-10 08:32:51 +02:00 committed by GitHub
parent 12c09cbc5a
commit 2ddae102eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 1 deletions

View File

@ -89,3 +89,14 @@ Example:
#[spirv(vertex)] #[spirv(vertex)]
fn main(#[spirv(invariant)] var: &mut f32) { } fn main(#[spirv(invariant)] var: &mut f32) { }
``` ```
## Workgroup shared memory
The `workgroup` attribute defines shared memory, which can be accessed by all invocations within the same workgroup. This corresponds to `groupshared` memory in hlsl or `shared` memory in glsl.
Example:
```rust
#[spirv(compute(threads(32)))]
fn main(#[spirv(workgroup)] var: &mut [Vec4; 4]) { }
```

View File

@ -1,4 +1,4 @@
// Tests muiltplying a `Mat3` by a `Vec3`. // Tests multiplying a `Mat3` by a `Vec3`.
// build-pass // build-pass
use spirv_std as _; use spirv_std as _;