Advertisement

Uniform buffer array alignment in HLSL vs SPIR-V

Started by October 07, 2017 06:17 AM
12 comments, last by GuyWithBeard 7 years, 4 months ago

So using

bool enabled;

int padd1; int padd2; int padd3;

instead would fix it? Makes sense! :) And it isn't that bad as i remember it.

yep!... it is quite simple actually... you just have to think that the padding goes before the given type to produce the proper alignment of the variable or struct, instead of going after it as a filling!... float is aligned to 4 bytes, float2 aligned to 8 bytes, while both float3 and float4 aligned to 16 bytes

Advertisement

I see, never would have guessed float3 and float4 would have the same requirement, but it makes sense.

Quote

...you just have to think that the padding goes before the given type...

That's pure gold! Thanks man!

This topic is closed to new replies.

Advertisement