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
Is your feature request related to a problem? Please describe.
It used to be that every type in HLSL was 4 bytes in size. Even bools are 4 bytes. So you could assume that everything was 4 byte aligned. However, this is no longer the case. We now have types like float16_t which have an alignment of 2 and uint64_t which have an alignment of 8. This is important if we are using templated ByteAddressBuffer stores because we have to be able to align our writes. However, there is currently no way to query what a struct's alignment is, so writing generic code that makes use of byte address buffer stores is difficult. The best we can do is just align every unknown type by 8 bytes.
Describe the solution you'd like
I would like an alignof operator like in C++11 to simply query a type's alignment.
Describe alternatives you've considered
The only workaround now (that I know of) is to make all stores of unknown types be 8 byte aligned.
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
It used to be that every type in HLSL was 4 bytes in size. Even bools are 4 bytes. So you could assume that everything was 4 byte aligned. However, this is no longer the case. We now have types like float16_t which have an alignment of 2 and uint64_t which have an alignment of 8. This is important if we are using templated ByteAddressBuffer stores because we have to be able to align our writes. However, there is currently no way to query what a struct's alignment is, so writing generic code that makes use of byte address buffer stores is difficult. The best we can do is just align every unknown type by 8 bytes.
Describe the solution you'd like
I would like an alignof operator like in C++11 to simply query a type's alignment.
Describe alternatives you've considered
The only workaround now (that I know of) is to make all stores of unknown types be 8 byte aligned.
The text was updated successfully, but these errors were encountered: