diff options
| author | cheneym2 <acheney@nvidia.com> | 2024-05-02 19:01:43 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-05-02 16:01:43 -0700 |
| commit | 6b3095758679a7699dc26d1af5521b65ace2cc83 (patch) | |
| tree | 6f3de6775e8fa3dc4cedc25d8457dc59ecf10cf9 /docs | |
| parent | c763750a7305fbf12c1f5c177260294a32fe286d (diff) | |
Slang: update pointer related documentation (#4088)
Slang does have some support for pointers. Remove an outdated
comment stating the contratry, and update the section that
describes pointer support to also list some relevant limitations.
Fixes #3970
Co-authored-by: Yong He <yonghe@outlook.com>
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/user-guide/02-conventional-features.md | 3 | ||||
| -rw-r--r-- | docs/user-guide/03-convenience-features.md | 13 |
2 files changed, 11 insertions, 5 deletions
diff --git a/docs/user-guide/02-conventional-features.md b/docs/user-guide/02-conventional-features.md index e50debd10..b748a72c0 100644 --- a/docs/user-guide/02-conventional-features.md +++ b/docs/user-guide/02-conventional-features.md @@ -18,8 +18,7 @@ Types Slang supports conventional shading language types including scalars, vectors, matrices, arrays, structures, enumerations, and resources. > #### Note #### -> Slang does not currently support pointer types as in C/C++. -> Pointers cannot be implemented robustly and completely on many of the target platforms Slang currently supports. +> Slang has limited support for pointers when targeting platforms with native pointer support, including SPIRV, C++, and CUDA. ### Scalar Types diff --git a/docs/user-guide/03-convenience-features.md b/docs/user-guide/03-convenience-features.md index e4732436e..ef43341f1 100644 --- a/docs/user-guide/03-convenience-features.md +++ b/docs/user-guide/03-convenience-features.md @@ -361,7 +361,7 @@ float4 myPackedVector = reinterpret<float4>(myVal); `reinterpret` can pack any type into any other type as long as the target type is no smaller than the source type. -## Pointers +## Pointers (limited) Slang supports pointers when generating code for SPIRV, C++ and CUDA targets. The syntax for pointers is similar to C, with the exception that operator `.` can also be used to dereference a member from a pointer. For example: ```csharp @@ -375,8 +375,15 @@ int test(MyType* pObj) Pointer types can also be specified using the generic syntax: `Ptr<MyType>` is equivalent to `MyType*`. -> #### Note -> Slang currently does not support pointers to immutable values, i.e. `const T*`. +### Limitations + +- Slang supports pointers to global memory, but not shared or local memory. For example, it is invalid to define a pointer to a local variable. + +- Coherent load/stores are unsupported + +- Custom alignment specification is unsupported. + +- Slang currently does not support pointers to immutable values, i.e. `const T*`. ## `struct` inheritance (limited) |
