mirror of
https://github.com/EmbarkStudios/rust-gpu.git
synced 2024-11-25 16:25:25 +00:00
book: add section for workgroup memory (#713)
This commit is contained in:
parent
12c09cbc5a
commit
2ddae102eb
@ -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]) { }
|
||||||
|
```
|
||||||
|
@ -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 _;
|
||||||
|
Loading…
Reference in New Issue
Block a user