What’s going on here, why is the float parameter taking up 4 bytes when put second and 8 when put first? Why can’t I just use sizeof(variable) to calculate what these values should be?
All primitive types are aligned to their size, this is a restriction of the GPU hardware (most processors that are not x86 have this restriction and even x86 takes a performance hit if you don’t do this). So if the double is specified after the float, then the float starts at address 0, and the double cannot start at address 4 because 4 is not 8-byte aligned, so it is padded and placed at address 8 instead.