mono/MonoGame — pull request #2862 by nkast (2014-07-31 17:18:26+00:00)
Title: MGFX hashCode

MGFX [resubmit]
Write a hash code of the shader/effect in the Header.

File version up to 6 from 5 because the header has changed. 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...)