Results 1 to 5 of 5

Thread: what kind of "wait" will glMapBuffer() do?

  1. #1
    Junior Member Newbie
    Join Date
    Aug 2009
    Posts
    22

    what kind of "wait" will glMapBuffer() do?

    when I use a PBO to upload image to a texture, I have to use glMapBuffer() to get a client address to copy the image, and then unmap the PBO and call glTexImage2D() to upload the image to a texture ( by DMA ).
    My question is : if I use only one PBO object to do the work, I upload the first image as described before, then I use glMapBuffer() to copy the second image, this will cause openGL driver to wait until the previous upload has finished ( wait util the DMA finished), so what kind of "wait" the driver will do for me ? will it wait on an event and yield CPU resource until DMA finished or it just do a busy loop to query the upload status?

  2. #2
    Senior Member Frequent Contributor scratt's Avatar
    Join Date
    May 2008
    Location
    Thailand
    Posts
    555

    Re: what kind of "wait" will glMapBuffer() do?

    My understanding is that it will "stall" the CPU until the GPU has released the resource.

    Why not double buffer your PBOs, or do some kind of texture streaming..
    http://www.songho.ca/opengl/gl_pbo.html#unpack

  3. #3
    Junior Member Newbie
    Join Date
    Aug 2009
    Posts
    22

    Re: what kind of "wait" will glMapBuffer() do?

    I know I can use two PBO objects to avoid waiting on GPU and make CPU and GPU work in parallel. But I just want to know the fact which kind of 'wait' will it do for me

    Thanks for your reply.

    BTW, can you make some clarification on your reply, dose cpu "stall" mean waiting on an event?

  4. #4
    Senior Member Frequent Contributor scratt's Avatar
    Join Date
    May 2008
    Location
    Thailand
    Posts
    555

    Re: what kind of "wait" will glMapBuffer() do?

    Yes, "stall" means it will wait (stop) until the GPU is finished with the contested resource.

    A cheap way to avoid the "stall" is to bind the buffer to NULL, and then reallocate it. But this simply moves the double buffering to the GPU side.

  5. #5
    Junior Member Newbie
    Join Date
    Aug 2009
    Posts
    22

    Re: what kind of "wait" will glMapBuffer() do?

    Thanks!

Similar Threads

  1. Switching between "arcball" and "fps-style" camera rotation
    By bsabiston in forum OpenGL: Basic Coding
    Replies: 6
    Last Post: 10-31-2017, 12:37 PM
  2. egl gles2 "function is no-op" "Mesa: User error"
    By unixmania in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 09-17-2013, 05:30 AM
  3. Replies: 1
    Last Post: 10-26-2012, 02:19 AM
  4. my "glMapBuffer" does not return pointer?
    By akashiraffee in forum OpenGL: Basic Coding
    Replies: 9
    Last Post: 12-20-2009, 07:26 AM
  5. "best" linux dist for a "Gelato" render farm?
    By ArtificialArtOfficial in forum OpenGL: Linux
    Replies: 10
    Last Post: 12-23-2007, 01:02 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean