diff options
| author | Yong He <yonghe@outlook.com> | 2024-12-05 19:33:55 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-12-06 03:33:55 +0000 |
| commit | 7dabfa76ccfb396e9d2019e2b6e01259d1661dc5 (patch) | |
| tree | 8f9a39b9d25d04051d02e63450f66c852d744e62 /docs | |
| parent | ecc5a39feecbf73feedf352214406c8752af798a (diff) | |
Implement explciit binding for metal and wgsl. (#5778)
* Respect explicit bindings in wgsl emit.
* Implement explciit binding generation for metal and wgsl.
* Update toc.
* Fix warnings in tests.
* Fix tests.
---------
Co-authored-by: Ellie Hermaszewska <ellieh@nvidia.com>
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/user-guide/a2-02-metal-target-specific.md | 8 | ||||
| -rw-r--r-- | docs/user-guide/a2-03-wgsl-target-specific.md | 6 | ||||
| -rw-r--r-- | docs/user-guide/toc.html | 2 |
3 files changed, 16 insertions, 0 deletions
diff --git a/docs/user-guide/a2-02-metal-target-specific.md b/docs/user-guide/a2-02-metal-target-specific.md index a69f466a9..827f11200 100644 --- a/docs/user-guide/a2-02-metal-target-specific.md +++ b/docs/user-guide/a2-02-metal-target-specific.md @@ -267,3 +267,11 @@ Metal requires explicit address space qualifiers. Slang automatically assigns ap | RW/Structured Buffers | `device` | | Group Shared | `threadgroup` | | Parameter Blocks | `constant` | + +## Explicit Parameter Binding + +The HLSL `:register()` semantic is respected when emitting Metal code. + +Since metal does not differentiate a constant buffer, a shader resource (read-only) buffer and an unordered access buffer, Slang will map `register(tN)`, `register(uN)` and `register(bN)` to `[[buffer(N)]]` when such `register` semantic is declared on a buffer typed parameter. + +`spaceN` specifiers inside `register` semantics are ignored.
\ No newline at end of file diff --git a/docs/user-guide/a2-03-wgsl-target-specific.md b/docs/user-guide/a2-03-wgsl-target-specific.md index 75a2a6da3..c802a682b 100644 --- a/docs/user-guide/a2-03-wgsl-target-specific.md +++ b/docs/user-guide/a2-03-wgsl-target-specific.md @@ -156,3 +156,9 @@ Matrix type translation A m-row-by-n-column matrix in Slang, represented as float`m`x`n` or matrix<T, m, n>, is translated to `mat[n]x[m]` in WGSL, i.e. a matrix with `n` columns and `m` rows. The rationale for this inversion of terminology is the same as [the rationale for SPIR-V](a2-01-spirv-target-specific.md#matrix-type-translation). Since the WGSL matrix multiplication convention is the normal one, where inner products of rows of the matrix on the left are taken with columns of the matrix on the right, the order of matrix products is also reversed in WGSL. This is relying on the fact that the transpose of a matrix product equals the product of the transposed matrix operands in reverse order. + +## Explicit Parameter Binding + +The `[vk::binding(index,set)]` attribute is respected when emitting WGSL code, and will translate to `@binding(index) @group(set)` in WGSL. + +If the `[vk::binding()]` attribute is not specified by a `:register()` semantic is present, Slang will derive the binding from the `register` semantic the same way as the SPIRV and GLSL backends.
\ No newline at end of file diff --git a/docs/user-guide/toc.html b/docs/user-guide/toc.html index 2cb6ce5e6..39cfd6164 100644 --- a/docs/user-guide/toc.html +++ b/docs/user-guide/toc.html @@ -233,6 +233,7 @@ <li data-link="metal-target-specific#value-type-conversion"><span>Value Type Conversion</span></li> <li data-link="metal-target-specific#conservative-rasterization"><span>Conservative Rasterization</span></li> <li data-link="metal-target-specific#address-space-assignment"><span>Address Space Assignment</span></li> +<li data-link="metal-target-specific#explicit-parameter-binding"><span>Explicit Parameter Binding</span></li> </ul> </li> <li data-link="wgsl-target-specific"><span>WGSL specific functionalities</span> @@ -249,6 +250,7 @@ <li data-link="wgsl-target-specific#pointers"><span>Pointers</span></li> <li data-link="wgsl-target-specific#address-space-assignment"><span>Address Space Assignment</span></li> <li data-link="wgsl-target-specific#matrix-type-translation"><span>Matrix type translation</span></li> +<li data-link="wgsl-target-specific#explicit-parameter-binding"><span>Explicit Parameter Binding</span></li> </ul> </li> </ul> |
