Skip to content

Commit 5e7b128

Browse files
authored
Document miscellaneous vector and GBuffer built-ins (#101)
1 parent b5f9929 commit 5e7b128

File tree

1 file changed

+48
-2
lines changed

1 file changed

+48
-2
lines changed

docs/built_ins.md

Lines changed: 48 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3159,11 +3159,57 @@ For clarity, the table of functions will be broken up into broad categories, and
31593159

31603160
### CPU and GPGPU miscellaneous Vector functions
31613161

3162-
TODO
3162+
| Name | Type | Description |
3163+
| :------------------ | :----------------------------------- | :-----------------------------------------------------------------------------------------------|
3164+
| `gevery{I}` | `I -> gbool` | Manually constructs an every call on the input. You probably won't use this directly |
3165+
| `every` | `gvec2b -> gbool` | Returns `true` if every element of the vector is `true` |
3166+
| `every` | `gvec3b -> gbool` | Returns `true` if every element of the vector is `true` |
3167+
| `every` | `gvec4b -> gbool` | Returns `true` if every element of the vector is `true` |
3168+
| `gsome{I}` | `I -> gbool` | Manually constructs a some call on the input. You probably won't use this directly |
3169+
| `some` | `gvec2b -> gbool` | Returns `true` if any element of the vector is `true` |
3170+
| `some` | `gvec3b -> gbool` | Returns `true` if any element of the vector is `true` |
3171+
| `some` | `gvec4b -> gbool` | Returns `true` if any element of the vector is `true` |
3172+
| `piecewiseIf{C, T}` | `(C, T, T) -> T` | Manually constructs a piecewise if call on the input. You probably won't use this directly |
3173+
| `if` | `(gvec2b, gvec2u, gvec2u) -> gvec2u` | Returns a new vector selecting values from the last two vectors based on the value of the first |
3174+
| `if` | `(gvec2b, gvec2i, gvec2i) -> gvec2i` | Returns a new vector selecting values from the last two vectors based on the value of the first |
3175+
| `if` | `(gvec2b, gvec2f, gvec2f) -> gvec2f` | Returns a new vector selecting values from the last two vectors based on the value of the first |
3176+
| `if` | `(gvec2b, gvec2b, gvec2b) -> gvec2b` | Returns a new vector selecting values from the last two vectors based on the value of the first |
3177+
| `if` | `(gvec3b, gvec3u, gvec3u) -> gvec3u` | Returns a new vector selecting values from the last two vectors based on the value of the first |
3178+
| `if` | `(gvec3b, gvec3i, gvec3i) -> gvec3i` | Returns a new vector selecting values from the last two vectors based on the value of the first |
3179+
| `if` | `(gvec3b, gvec3f, gvec3f) -> gvec3f` | Returns a new vector selecting values from the last two vectors based on the value of the first |
3180+
| `if` | `(gvec3b, gvec3b, gvec3b) -> gvec3b` | Returns a new vector selecting values from the last two vectors based on the value of the first |
3181+
| `if` | `(gvec4b, gvec4u, gvec4u) -> gvec4u` | Returns a new vector selecting values from the last two vectors based on the value of the first |
3182+
| `if` | `(gvec4b, gvec4i, gvec4i) -> gvec4i` | Returns a new vector selecting values from the last two vectors based on the value of the first |
3183+
| `if` | `(gvec4b, gvec4f, gvec4f) -> gvec4f` | Returns a new vector selecting values from the last two vectors based on the value of the first |
3184+
| `if` | `(gvec4b, gvec4b, gvec4b) -> gvec4b` | Returns a new vector selecting values from the last two vectors based on the value of the first |
3185+
| `pack4x8snorm` | `gvec4f -> gu32` | Packs four floats from -1 to 1 into a singular `gu32` |
3186+
| `pack4x8snorm` | `f32[4] -> u32` | Packs four floats from -1 to 1 into a singular `u32` |
3187+
| `pack4x8unorm` | `gvec4f -> gu32` | Packs four floats from 0 to 1 into a singular `gu32` |
3188+
| `pack4x8unorm` | `f32[4] -> u32` | Packs four floats from 0 to 1 into a singular `u32` |
3189+
| `pack2x16snorm` | `gvec2f -> gu32` | Packs two floats (at half precision) from -1 to 1 into a singular `gu32` |
3190+
| `pack2x16snorm` | `f32[2] -> u32` | Packs two floats (at half precision) from -1 to 1 into a singular `u32` |
3191+
| `pack2x16unorm` | `gvec2f -> gu32` | Packs two floats (at half precision) from 0 to 1 into a singular `gu32` |
3192+
| `pack2x16unorm` | `f32[2] -> u32` | Packs two floats (at half precision) from 0 to 1 into a singular `u32` |
3193+
| `pack2x16float` | `gvec2f -> gu32` | Packs two floats (at half precision) into a singular `u32` |
3194+
| `unpack4x8snorm` | `gu32 -> gvec4f` | Unpacks four floats from -1 to 1 from a singular `gu32` |
3195+
| `unpack4x8snorm` | `u32 -> f32[4]` | Unpacks four floats from -1 to 1 from a singular `u32` |
3196+
| `unpack4x8unorm` | `gu32 -> gvec4f` | Unpacks four floats from 0 to 1 from a singular `gu32` |
3197+
| `unpack4x8unorm` | `u32 -> f32[4]` | Unpacks four floats from 0 to 1 from a singular `u32` |
3198+
| `unpack2x16snorm` | `gu32 -> gvec2f` | Unpacks two floats (at half precision) from -1 to 1 from a singular `gu32` |
3199+
| `unpack2x16snorm` | `u32 -> f32[2]` | Unpacks two floats (at half precision) from -1 to 1 from a singular `u32` |
3200+
| `unpack2x16unorm` | `gu32 -> gvec2f` | Unpacks two floats (at half precision) from 0 to 1 from a singular `gu32` |
3201+
| `unpack2x16unorm` | `u32 -> f32[2]` | Unpacks two floats (at half precision) from 0 to 1 from a singular `u32` |
3202+
| `unpack2x16float` | `gu32 -> gvec2f` | Unpacks two floats (at half precision) from a singular `u32` |
31633203

31643204
### GBuffer-specific functions
31653205

3166-
TODO
3206+
| Name | Type | Description |
3207+
| :--------------- | :-------------------------------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------- |
3208+
| `storageBarrier` | `() -> storageBarrier` | Special function that requires all parallel execution to synchronize after writing to a storage buffer. Intentionally broken on Metal (MacOS), use with caution |
3209+
| `map` | `(GBuffer, gu32 -> gu32) -> GBuffer` | Construct a new GBuffer mapping the contents from one `gu32` to another |
3210+
| `map` | `(GBuffer, gi32 -> gi32) -> GBuffer` | Construct a new GBuffer mapping the contents from one `gi32` to another |
3211+
| `map` | `(GBuffer, gf32 -> gf32) -> GBuffer` | Construct a new GBuffer mapping the contents from one `gf32` to another |
3212+
| `map{G, G2}` | `(GBuffer, (G, gu32) -> G2) -> GBuffer` | Construct a new GBuffer mapping the contents from one GPU type `G` to another `G2`, receiving the buffer index `gu32` as well |
31673213

31683214
### GPU rendering-related functions
31693215

0 commit comments

Comments
 (0)