You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In node shaders that uses an input record the .Get() access mechanism is a bit clumsy:
Output[gid] = inputRecord.Get().data1[gid];
and it is tempting to use a local variable to write code like:
const RecordType record = inputRecord.Get();
Output[gid] = record.data1[gid];
...
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:
Output[gid] = inputRecord->data1[gid];
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.
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
The text was updated successfully, but these errors were encountered: