Advertisement

[DX11] Getting the size of a structure in HLSL

Started by November 25, 2011 01:34 AM
3 comments, last by MJP 7 years, 6 months ago
Does HLSL offer a way to get the size in bytes of a structure, similar to sizeof( MyStruct )?



http://msdn.microsoft.com/en-us/library/windows/desktop/bb509638(v=vs.85).aspx

Can't find it anywhere, so probably no.

I can't imagine why would you even need it anyways.
Advertisement
On 11/25/2011 at 4:06 PM, Ripiz said:

http://msdn.microsoft.com/en-us/library/windows/desktop/bb509638(v=vs.85).aspx

Can't find it anywhere, so probably no.

I can't imagine why would you even need it anyways.

For compile-time checks?


static_assert(sizeof(Buffer) == 64, "CPU/GPU struct mismatch");

 

🧙

No, there's no sizeof() in HLSL unfortunately. 

This topic is closed to new replies.

Advertisement