Jump to content

  • Log In with Google      Sign In   
  • Create Account

#Actualmhagain

Posted 20 April 2013 - 03:46 PM

In terms of timing, in theory using an FBO should be faster as CopyTexImage will respecify a new texture with the appropriate dimensions, format and miplevels, then transfer the data to that new texture (CopyTexSubImage should skip the respecification step). An FBO doesn't need the additional data transfer so can save on the time required to do it.

On the other hand, changing a render target can be a time-consuming operation. It may involve a CPU/GPU synchronization (see http://www.opengl.org/wiki/Synchronization#Implicit_synchronization) which may be a bigger performance impact. If you're doing it a lot of times per frame then there may be a cutoff point beyond which the bandwidth cost of CopyTexImage (or CopyTexSubImage) is the lesser evil. (And remember that an FBO means minimum two render target changes per frame, so that's two potential synchronization points.)

On the other other hand, there are things that FBOs allow you to do that CopyTex(Sub)Image doesn't. You want multiple render targets, for example? Gotta use an FBO.

So that's a lot of "maybe"s and "might"s and whatnot. By now you should be getting the idea that there is no absolute answer to this question, and that cases can exist where either is preferable to the other, and that sometimes those cases can be implementation-dependent. So in the end we need to fall back on the time-honoured answer: benchmark, find which is best for your program, and use that.

 

(Finally, and as a historical note, Doom 3 used CopyTex(Sub)Image and didn't suffer overly much from it, but FBOs didn't exist back then so maybe that's not too relevant a point...)


#3mhagain

Posted 17 April 2013 - 05:57 PM

In terms of timing, in theory using an FBO should be faster as CopyTexImage will respecify a new texture with the appropriate dimensions, format and miplevels, then transfer the data to that new texture (CopyTexSubImage should skip the respecification step). An FBO doesn't need the additional data transfer so can save on the time required to do it.

On the other hand, changing a render target can be a time-consuming operation. It may involve a CPU/GPU synchronization (see http://www.opengl.org/wiki/Synchronization#Implicit_synchronization) which may be a bigger performance impact. If you're doing it a lot of times per frame then there may be a cutoff point beyond which the bandwidth cost of CopyTexImage (or CopyTexSubImage) is the lesser evil. (And remember that an FBO means minimum two render target changes per frame, so that's two potential synchronization points.)

On the other other hand, there are things that FBOs allow you to do that CopyTex(Sub)Image doesn't. You want multiple render targets, for example? Gotta use an FBO.

So that's a lot of "maybe"s and "might"s and whatnot. By now you should be getting the idea that there is no absolute answer to this question, and that cases can exist where either is preferable to the other, and that sometimes those cases can be implementation-dependent. So in the end we need to fall back on the time-honoured answer: benchmark, find which is best for your program, and use that.

 

(Finally, and as a historical note, Doom 3 used CopyTex(Sub)Image and didn't suffer overly much from it, but FBOs didn't exist back then so maybe that's not too elevant a point...)


#2mhagain

Posted 17 April 2013 - 05:54 PM

In terms of timing, in theory using an FBO should be faster as CopyTexImage will respecify a new texture with the appropriate dimensions, format and miplevels, then transfer the data to that new texture (CopyTexSubImage should skip the respecification step). An FBO doesn't need the additional data transfer so can save on the time required to do it.

On the other hand, changing a render target can be a time-consuming operation. It may involve a CPU/GPU synchronization (see http://www.opengl.org/wiki/Synchronization#Implicit_synchronization) which may be a bigger performance impact. If you're doing it a lot of times per frame then there may be a cutoff point beyond which the bandwidth cost of CopyTexImage (or CopyTexSubImage) is the lesser evil. (And remember that an FBO means minimum two render target changes per frame, so that's two potential synchronization points.)

On the other other hand, there are things that FBOs allow you to do that CopyTex(Sub)Image doesn't. You want multiple render targets, for example? Gotta use an FBO.

So that's a lot of "maybe"s and "might"s and whatnot. By now you should be getting the idea that there is no absolute answer to this question, and that cases can exist where either is preferable to the other, and that sometimes those cases can be implementation-dependent. So in the end we need to fall back on the time-honoured answer: benchmark, find which is best for your program, and use that.

#1mhagain

Posted 17 April 2013 - 05:53 PM

In terms of timing, in theory using an FBO should be faster as CopyTexImage will respecify a new texture with the appropriate dimensions, format and miplevels, then transfer the data to that new texture (CopyTexSubImage should skip the respecification step).  An FBO doesn't need the additional data transfer so can save on the time required to do it.

 

On the other hand, changing a render target can be a time-consuming operation.  It may involve a CPU/GPU synchronization (see http://www.opengl.org/wiki/Synchronization#Implicit_synchronization) which may be a bigger performance impact.  If you're doing it a lot of times per frame then there may be a cutoff point beyond which the bandwidth cost of CopyTexImage (or CopyTexSubImage) is the lesser evil.  (And remember that an FBO means minimum wo render target changes per frame, so that's two potential synchronization points.)

 

On the other other hand, there are things that FBOs allow you to do that CopyTex(Sub)Image doesn't.  You want multiple render targets, for example?  Gotta use an FBO.

 

So that's a lot of "maybe"s and "might"s and whatnot.  By now you should be getting the idea that there is no absolute answer to this question, and that cases can exist where either is preferable to the other, and that sometimes those cases can be implementation-dependent.  So in the end we need to fall back on the time-honoured answer: benchmark, find which is best for your program, and use that.


PARTNERS