MRTs of different sizes

Discussion area about developing or extending OGRE, adding plugins for it or building applications on it. No newbie questions please, use the Help forum for that.
User avatar
sparkprime
Ogre Magi
Posts: 1137
Joined: Mon May 07, 2007 3:43 am
Location: Ossining, New York
x 13

MRTs of different sizes

Post by sparkprime »

It seems that it is quite possible in d3d9 and gl to render to an MRT comprised of buffers of different formats and sizes, but Ogre has a restriction that they must all be the same. What's the origin of this and can it be easily dropped?
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5511
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1379

Re: MRTs of different sizes

Post by dark_sylinc »

Huh? Last time I checked, D3D9 forces MRTs to have the same resolution. As for the bit-depth, they have to be all the same unless the mrt independent bpp flag is set; which Ogre already handles that.

As for GL, GL 2.x is the same, but also enforces an idiotic rule (and I say that because I don't know where the board came with that restriction, as no GPU ever had this contraint) that MRTs must also be of the same type (i.e. you can't mix Float with integer formats). Don't know what happened after 3.x

BTW, the cost of using MRTs of different formats varies between NVIDIA & AMD cards. You can find them in GDC 11's slides from Nicolas Thibieroz (slide 14)

Cheers
Dark Sylinc
User avatar
sparkprime
Ogre Magi
Posts: 1137
Joined: Mon May 07, 2007 3:43 am
Location: Ossining, New York
x 13

Re: MRTs of different sizes

Post by sparkprime »

Thanks, I meant bit depths rather than sizes :)

Do you recall where the GL 2.x restriction is documented?
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5511
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1379

Re: MRTs of different sizes

Post by dark_sylinc »

After some googling, this is what I found:

* What Ogre does if you force OpenGL to use different formats: Here.
* Restrictions: Here. Note where it says "All images attached the color attachment points must have the same internal format."
* More info: Here. Note that this site talks about the state of OpenGL 3.0, and that the presence of the extension "EXTX_mixed_framebuffer_format" allows for MRTs of different formats (never heard of that one before).

* More info: Here. Note how they end up solving the issue ala (ugly) OpenGL style: Try it. If it works, it's supported. Probably Ogre should do this too. During RenderSystem initialization, the RenderSystem would create an FBO and try an MRT of different bit depths then and one of different formats (using simple formats, else we risk for a false negative). If GL_FRAMEBUFFER_COMPLETE was returned, then allow mixed formats and report when a specific combination failed where the driver returned anything other than "complete" (but don't crash).