I realized that the initialization of Texture2DMS, and Texture2DMSArray is not correct on this patch. These textures require a "number of samples" parameter, as in Gio's branch. Still, the rest of the patch may be worth considering.