From 2ddae102eb386019baf7ba93eb5c3257da68714a Mon Sep 17 00:00:00 2001 From: Markus Siglreithmaier Date: Tue, 10 Aug 2021 08:32:51 +0200 Subject: [PATCH] book: add section for workgroup memory (#713) --- docs/src/attributes.md | 11 +++++++++++ tests/ui/glam/mat3_vec3_multiply.rs | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/docs/src/attributes.md b/docs/src/attributes.md index 187f9661a2..30cd21ed6e 100644 --- a/docs/src/attributes.md +++ b/docs/src/attributes.md @@ -89,3 +89,14 @@ Example: #[spirv(vertex)] 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]) { } +``` diff --git a/tests/ui/glam/mat3_vec3_multiply.rs b/tests/ui/glam/mat3_vec3_multiply.rs index 2efb5109c3..848143e47b 100644 --- a/tests/ui/glam/mat3_vec3_multiply.rs +++ b/tests/ui/glam/mat3_vec3_multiply.rs @@ -1,4 +1,4 @@ -// Tests muiltplying a `Mat3` by a `Vec3`. +// Tests multiplying a `Mat3` by a `Vec3`. // build-pass use spirv_std as _;