PDA

View Full Version : copy color attachment vs mrt



TheAvatar
01-11-2013, 03:42 AM
Hi,

i have an FBO with two color attachments in my OpenGL 3 application.
Both buffers have the same dimensions and precision. I don't use any mipmapping and probably no multisampling.
The first attachment is filled by a rendering pass.

Now, i want the contents of the first attachment simply copied into the second one to be used in another render pass.
This needs to be done each frame.

What is the fastest way to accomplish this?

I could use glBlitFramebuffer() or I could use MRT - write the same fragment during the first pass into two color attachments.
What about glCopyTexSubImage?

Any suggestions, comments?

Thanks

tonyo_au
01-11-2013, 07:00 PM
I would write it in the shader during the first pass - but can I ask if they are identical why you at not just using the first buffer - it can be attached to multiple fbo's.

TheAvatar
01-14-2013, 02:56 AM
I use the GPU for image processing where image files read from disk are converted into an easy-to-process format, then fed into a filtering pipeline and are finally put on the screen.
If for example one of the filter's settings is changed I have to re-iterate over the whole pipeline including reading from disc, because I need the original image.
So I'd like to use the first buffer as a read-only backup buffer to avoid per-frame HDD-access.

Maybe it is better to keep the original image on the CPU-side?
I just thought if I use the GPU to create the first image format I might as well keep it there, make copy GPU-to-GPU and use the map/umapBuffer method to access the copy.

tonyo_au
01-14-2013, 05:52 AM
I believe glBlitFramebuffer() is also a gpu-gpu function so it is probably much of a muchness whether you copy this way or write to a second attachment. What ever seems neater in the code.