mono/MonoGame — pull request #2522 by nkast (2014-05-12 13:59:30+00:00)
Title: MGFX hashCode 

*MGFX*
Write a hash code of the shader/effect in the Header.

File version up to 6 from 5 because the header has chaneged. I had to
make room for 4 more bytes.

Everything after the header (ConstantBuffers/Shaders/etc) has to be
written into a Memory Stream.
We then calculate a hash from this memory stream and write it to the
header. at the end the memory stream is written into the final stream.
This makes it possible to accept a non seekable stream (network?) but
use more memory.
The alternative would be to store the position, write a null value,
write the rest of the file and seek back to update the hash value.

*MonoGame.Framework/Utilities/Hash.cs *
A modified version of Hash.ComputeHash() that accept streams.
This is only needed if we are going to support MGFX version 5 files.

*MonoGame.Framework/Graphics/Effect/Effect.cs*
Group header variables into a single struct (MGFXHeader).

Move code that reads the header from ReadEffect() into the new method
ReadHeader.

We now have to read the header every time inside the constructor.
(It seems that MemoryStream that's created from a byte array doesn't
involve memcopy but use the array directly...)

Note: There is a platform (PSM, PlayStation Mobile?) that seems to handle things differently.
Probably I broke something there, because the code that reads the header has been moved from ReadEffect to the constructor.