PDA

View Full Version : FBO switching



Fugitive
05-05-2010, 06:28 AM
I need to render several objects into textures of different sizes. At a single time, only one texture is attached to the FBO. Do all the textures still have to be of the same size?

I have been using multiple FBOs (one each for a single texture size) but I know texture-switching on an FBO is faster than FBO switching, which is why I am looking into using a single FBO if possible.

DmitryM
05-05-2010, 07:32 AM
FBO can have different-size attachments. In case of rendering to them at once, the common sub-rectangle is chosen, iirc.

Dark Photon
05-05-2010, 08:00 AM
I need to render several objects into textures of different sizes. At a single time, only one texture is attached to the FBO. Do all the textures still have to be of the same size?

I have been using multiple FBOs (one each for a single texture size) but I know texture-switching on an FBO is faster than FBO switching, which is why I am looking into using a single FBO if possible.
Not necesesarily. See this thread (http://www.opengl.org/discussion_boards/ubbthreads.php?ubb=showflat&Number=276688#Post2766 88). Then time both on your system and see.

skynet
05-05-2010, 10:46 AM
but I know texture-switching on an FBO is faster than FBO switching,

Where do you know this from? I remember one presentation from 2005(!)which introduced the back-then-brand-new-feature. Indeed it told, switching FBO were slower than re-attaching textures. I consider this information outdated and wrong.

FBO's were introduced for a specific purpose, to be able to validate the completeness of it (i.e. the complex state it captures) quickly. If you don't change a 'complete' FBO, its completeness can be evaluated very fast. Switching between 'complete' FBOs should be very quick this way, since almost no validation needs to be done.
Changing attachments of FBOs causes a new validation of the completeness which can be (according to the EXT_fbo specs) heavy.
So, how should switching between FBOs be slower than reattaching textures to them?

Fugitive
05-05-2010, 03:18 PM
^I was basing my knowledge on precisely that old and outdated presentation by Simon Green. Its a pity that the particular presentation in question is the only 'official' reference on the subject.

Anyway, looks like I might just stick to FBO switching for now. I'll benchmark the two approaches when I have the time.

Dark Photon
05-06-2010, 05:10 AM
Anyway, looks like I might just stick to FBO switching for now. I'll benchmark the two approaches when I have the time.
No problem with using FBOs. And prior to benching, I'd suggest that you allocate one FBO per texture res+format combination.