Nominom / BCnEncoder.NET

Cross-platform texture encoding libary for .NET. With support for BC1-3/DXT, BC4-5/RGTC and BC6-7/BPTC compression. Outputs files in ktx or dds formats.
The Unlicense
108 stars 16 forks source link

Change Marshal.SizeOf to Unsafe.SizeOf #12

Closed Nominom closed 3 years ago

Nominom commented 3 years ago

This currently doesn't break anything but Unsafe.SizeOf is the correct way to do it.

onepiecefreak3 commented 3 years ago

What is the difference between Marshal.SizeOf and Unsafe.SizeOf that makes Unsafe.SizeOf the "correct" way to do it?

Nominom commented 3 years ago

They both produce the same result in most cases. Seems like Marshal.SizeOf is intended for when sending raw data between C# and C/C++, while Unsafe.SizeOf is for internal C# use. The "marshal" can add padding bytes sometimes if necessary. At least this is what I remember reading.

Nominom commented 3 years ago

This was fixed in the latest commit already though.