Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Page 1 of 5 123 ... LastLast
Results 1 to 10 of 47

Thread: VBOs strangely slow?

  1. #1
    Junior Member Newbie
    Join Date
    Feb 2010
    Posts
    14

    VBOs strangely slow?

    I have here two short programs doing the same thing, namely drawing random points on the screen.

    The first one uses VBOs; the second, OpenGL 1.1 drawArrays. There are a couple parameters to play with; the number of VBOs to use in a round-robin fashion, etc. It doesn't really matter what parameters are used, as the results are approximately the same whatever you do.

    That is, that the second, VBO-less program runs roughly ten times faster than the first in all cases, except if you comment out the VBO update entirely and only initialize them at startup, in which case they're the same speed.

    Now, this is hardly the ideal use for VBOs - being used only once, and all - but it still seems odd to me that the difference would be that dramatic. Thus, my question: Am I doing something obviously and horribly wrong?

  2. #2
    Member Regular Contributor DmitryM's Avatar
    Join Date
    Mar 2009
    Location
    Toronto
    Posts
    435

    Re: VBOs strangely slow?

    I recall several discussions already claiming VBOs are slow. It almost doesn't make sense because they are the only choice in pure GL3. So, unless you are not aiming at future or doing something wrong, you can expect them to work at least as fast as vertex arrays.

    Anyway, did you try to play with vbo usage hint parameter?

  3. #3
    Junior Member Newbie
    Join Date
    Feb 2010
    Posts
    14

    Re: VBOs strangely slow?

    Yes, all _DRAW permutations have been tested; they make no apparent difference. (STATIC_DRAW was no slower, even.. you'd think it would be)

    I also tested bufferSubData vs. bufferData in those permutations.

  4. #4
    Junior Member Newbie
    Join Date
    Feb 2010
    Posts
    14

    Re: VBOs strangely slow?

    Orr it could be because the lowermost program actually transfers far less data. Um. Yeah.

    Though even with that fixed, VBOs are /still/ 40% slower.

  5. #5
    Senior Member OpenGL Guru
    Join Date
    May 2009
    Posts
    4,948

    Re: VBOs strangely slow?

    Why are you creating the buffer object with GL_DYNAMIC_DRAW in one case, and GL_STREAM_DRAW in another?

    Also, what hardware are you running this on?

  6. #6
    Junior Member Newbie
    Join Date
    Feb 2010
    Posts
    14

    Re: VBOs strangely slow?

    I was testing various combinations to see what, if anything, had an effect. So far nothing's produced any change at all.

    Fixing the non-VBO case so the entire array is actually used, I'm looking at ~6,000ms for non-VBO, ~10,000ms for VBO (absolutely regardless of that setting), and ~8,000ms to upload it as a texture which I then proceed not to use.

    My preference would be to have a way to do this via DMA. Hand the drivers a pointer which I can tell them I won't be changing until some later point (at which point I presumably need a sync call of some sort), and let the DMA engine do the memory-copy. I don't suppose that's possible?

  7. #7
    Senior Member OpenGL Guru
    Join Date
    May 2009
    Posts
    4,948

    Re: VBOs strangely slow?

    So, what hardware are you running this on?

    Also, why are you use the ARB extension function pointers, rather than the core function pointers? I don't imagine that this will have any effect, but it does seem highly unnecessary.

    I don't suppose that's possible?
    Have you tried mapping the buffers?

  8. #8
    Junior Member Newbie
    Join Date
    Feb 2010
    Posts
    14

    Re: VBOs strangely slow?

    In the end, glMapBuffer was (much) faster; preceding it with a glBufferData with a null pointer (discarding its contents), 10% faster than the vertex array.

    All's well that ends well? I guess, but it's still not obvious to me why the other way of using them is in this case /slower/.

    EDIT: Well, yes, MapBuffer should be able to use DMA transfers.. that makes perfect sense. That's still missing a way to do a DMA transfer from an array that needs to stay readable in main memory, but I suppose it doesn't matter; I don't need that ability right now.

    And I was using the ARB versions because they have the exact same API, thus are supported everywhere the core versions are (that I've seen); the other way around is not quite the case, though I haven't personally seen that either.

  9. #9
    Senior Member OpenGL Pro Ilian Dinev's Avatar
    Join Date
    Jan 2008
    Location
    Watford, UK
    Posts
    1,290

    Re: VBOs strangely slow?

    Try also the glBuffersubdata approach.
    YMMV

  10. #10
    Junior Member Newbie
    Join Date
    Feb 2010
    Posts
    14

    Re: VBOs strangely slow?

    I tried it (I think?), just uncomment the glBufferSubData line in the paste.. no difference.

Posting Permissions

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