I'm writing a deferred renderer, targeting OpenGL >= 3.1. Assuming that I stick to the required color-renderable formats given in the spec - is it legal to have several color attachments of different formats? That is, can I create a framebuffer with an RGBA8888 attachment and an RG16F attachment, and expect to be able to render to both buffers without issue?

The spec seems vague on the matter. I've seen people discussing DirectX claiming that it's not doable there, but I've also seen blog posts discussing their own configurations that do seem to have color attachments with multiple formats (without mentioning whether they were referring to DirectX or OpenGL). Assuming that the blog posts aren't outright lies, I assume the DirectX limitation is just a limitation imposed by the specification, and that most hardware built in the last five years or so is capable of doing it?