0
\$\begingroup\$

I've read that above GL4.3, to copy one tex to the other, glCopyImageSubData will be the fastest solution,

but after some forloop nested compare, it just not is the case here , glCopyImageSubData is a bunch of FPS slower(~220fps vs ~260fps),

what am I missing can you tell ? is it my hardware ? I'm on GTX 1060 Max-Q ... both testbuf1 & testbuf2 own a TEXTURE_2D buffer and a framebuffer, same size and all

for (int i = 0; i < 1000; ++i) {

    if (compare) {

        glBindFramebuffer(GL_FRAMEBUFFER, testbuf2.fb_id);

        glClearColor(0,0,0,0); 

        glClear(GL_COLOR_BUFFER_BIT|GL_STENCIL_BUFFER_BIT);

        glBindTexture(GL_TEXTURE_2D,testbuf1.tex_id);

        glUseProgram(shader.program);

        vbo.draw();

    }else{

        glCopyImageSubData(
                        
            testbuf1.tex_id, GL_TEXTURE_2D, 0, 0, 0, 0, 
            testbuf2.tex_id, GL_TEXTURE_2D, 0, 0, 0, 0, 
            testbuf1.width,testbuf1.height, 1);

    }

 } 
\$\endgroup\$
2
  • 1
    \$\begingroup\$ Are you absolutely certain you're measuring the timing correctly? Your bind-and-draw method, in particular, is just adding commands to your drivers command buffer, it's not actually doing any work. Put a glFinish on every iteration to ensure that you're correctly measuring time to do the work. \$\endgroup\$ Aug 1, 2021 at 4:42
  • \$\begingroup\$ @MaximusMinimus hmm ... I understand your point that in my for loop I wasn't unbinding anything, so with this modification, FPS drops to 80 , glcopySub is now way ahead indeed ! Although if I only add glFinish() to both glCopy and bind&draw , result is all the same FPS drops hell down to ~26FPS .... \$\endgroup\$
    – ebkgne
    Aug 1, 2021 at 9:29

0

You must log in to answer this question.

Browse other questions tagged .