Open tcorringham opened 2 months ago
This adds new syntax to HLSL, so this is a language change and needs to be treated as such. Sending to hlsl-specs.
This feature is likely intwined with the larger feature to add reference support to HLSL (https://github.com/microsoft/hlsl-specs/blob/main/proposals/0006-reference-types.md).
In node shaders that uses an input record the .Get() access mechanism is a bit clumsy:
and it is tempting to use a local variable to write code like:
In both cases any fields in the record that are not referenced are not loaded. In the first version, only the single array element indexed (by variable gid) is loaded. However, in the second version all elements of the array are loaded (unless the array index happens to have a known value). This can lead to unexpected and surprising runtime overheads, especially when converting existing code to use work graphs.
Describe the solution you'd like The proposed '->' operator would allow more natural code of the form:
Alternatively, where there are only invariant indices used (possibly where only a single value is used as an index), only those need be loaded - effectively deferring the generation of the loads until the usage is known just as if the Get() had been used as in the first example.
Describe alternatives you've considered The use of a macro is an alternative to the first example, but just as ugly.
Additional context Example on gobolt : https://godbolt.org/z/bM6nGh1eo