Add routines to readback textures and render targets to main memory.  Also add utility functions for calculating sizes of textures, including mip levels.
Copy row-by-row in readback routines, in case pitch is different