Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 2 of 2

Thread: HELP low performance in PBO readback !!

  1. #1
    Junior Member Newbie
    Join Date
    Mar 2007
    Location
    Canada
    Posts
    19

    HELP low performance in PBO readback !!

    Hi

    i use a PBO approach to grab a bitmap from my 3d scene . steps are the following :

    glBindBufferARB(GL_PIXEL_PACK_BUFFER_ARB, pbo1);

    glReadPixels(0, 0,bWIDTH,bHEIGHT,GL_BGRA, GL_UNSIGNED_BYTE, 0);

    copymem(glMapBufferARB(GL_PIXEL_PACK_BUFFER_ARB,GL _READ_ONLY_ARB)^, buffer,BWidth * BHeigh * 4);

    glBindBufferARB(GL_PIXEL_PACK_BUFFER_ARB, pbo2);

    glReadPixels(0, 0,pWIDTH,pHEIGHT ,GL_BGRA, GL_UNSIGNED_BYTE, 0);

    copymem(glMapBufferARB(GL_PIXEL_PACK_BUFFER_ARB, GL_READ_ONLY_ARB)^,bitmapbuf, bWidth * bHeigh * 4);
    glUnmapBufferARB(GL_PIXEL_PACK_BUFFER_ARB);

    swap(pbo1,pbo2)

    with methode i get 15~25 fps low than a direct :

    glReadPixels(0, 0,pWIDTH,pHEIGHT ,GL_BGRA, GL_UNSIGNED_BYTE, bitmapbuf);

    as i see in many forum the PBO should be more Faster than the glReadPixels one


    my card is : nVidia Geforce 7600 GS
    forceware version : 169.21
    Bus PCI Express x16
    CPU : P4 3.0Ghz



    are there any bad implementation in my PBO code, how can i boost it ?

    help please

    Thanks in Advance

  2. #2
    Junior Member Regular Contributor
    Join Date
    Apr 2001
    Posts
    180

    Re: HELP low performance in PBO readback !!

    The point of using a PBO to do transfers, is that it can happen asynchronously. However, from in the code you posted, you immediately call MapBuffer, which forces the graphics card to wait for the transfer to happen, thus negating much, if not all, of the effect of the async transfer.

    You should do other things between the ReadPixel call and the MapBuffer call. For instance, you could start the ReadPixel using pbo2, THEN call MapBuffer/CopyMem with pbo1, and then swap the two pbo handles (you'll have to skip the map/copy the first time around). Ie something like

    glBindBufferARB(GL_PIXEL_PACK_BUFFER_ARB, pbo2);

    glReadPixels(0, 0,bWIDTH,bHEIGHT,GL_BGRA, GL_UNSIGNED_BYTE, 0);

    if (!firstFrame) {
    glBindBufferARB(GL_PIXEL_PACK_BUFFER_ARB, pbo1);
    copymem(glMapBufferARB(GL_PIXEL_PACK_BUFFER_ARB,GL _READ_ONLY_ARB)^, buffer, BWidth * BHeigh * 4);
    glUnmapBufferARB(GL_PIXEL_PACK_BUFFER_ARB);
    firstFrame = false;
    }

    swap(pbo1, pbo2);

    If I remember correctly that is, been a while since I messed with PBO's.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •