flibitijibibo/MonoGame — pull request #126 by sulix (2013-12-05 12:11:32+00:00)
Title: Improve Texture2D load performance (eliminate a copy)

All texture loads in the XNA context system create an extra temp. copy.
This (extremely hacky) patchset hacks around it.

The first commit is pretty clean, and implements the elementCount field in Texture2D.SetData.
The second basically sends the backing memory for the stream that the texture that's being loaded from into Texture2D.SetData. It's a pretty horrible idea, so I haven't bothered cleaning up the code. I'm happy to do so if you want it in, anyway.
The only really nice way of getting rid of this copy requires a lot of refactoring, which I frankly couldn't be bothered with.

— David