Not logged in, Join Here! or Log In Below:  
News Articles Search    

 Home / 3D Theory & Graphics / How does glMapBufferARB work? Account Manager
Archive Notice: This thread is old and no longer active. It is here for reference purposes. This thread was created on an older version of the flipcode forums, before the site closed in 2005. Please keep that in mind as you view this thread, as many of the topics and opinions may be outdated.

May 06, 2005, 05:37 AM

hello lads

Question: As i map a OpenGL buffer object using glMapBufferARB() and write data to the returned memory pointer (using memcopy()), when exactly is the data being transfered to VRAM? Immediately? When i glUnmapBufferARB() the buffer? Or when i call glFinish()?

Somebody knows?

Many thanks

Erik Faye-Lund

May 06, 2005, 05:55 AM

d3lphi: that depends entirely on the implementation. in most common desktop-cases, it's a pointer directly to agp-memory. as far as i remember, the spec doesn't even mention any s no memory-transfer. my point is, there might and might not be a memory-transfer. this is, however not anything you should worry about. writing to the pointer after unmapping it however, leads to undefined operation. in most implementations, i guess you'll get a page-fault.


May 06, 2005, 06:38 AM

hm. I would not worry about that, too, but i'm working on a benchmark-application that extracts transfer-rates to VRAM and back.
I tried not to waste time doing mapping/unmapping/glFinishing(), but i think i will test those alternatives and notice the difference ..

meanwhile, ty

Erik Faye-Lund

May 07, 2005, 06:21 PM

in that case opengl is a very bad choice for benchmarking-platform, simply because the spec is so vague. unless you're working with a given set of hardware and drivers, you can't really know for sure what's going on under the hood. remember, vbos don't need to even be put in vram ;)


May 08, 2005, 06:54 AM

There definitively ARE memory transfers, because the driver must take immediate notice of the data you give it. It cannot postpone the transfer and hope that the pointer/data will still be valid some time later.

The real question is: where does that data end up ?
The driver could give you a pointer
- to non-local VRAM (AGP memory),
- to local VRAM (mapped in the CPUs address space),
- to system RAM, and leave it there
- to system RAM, and do another SYS->VRAM or SYS->AGP transfer later.

What you'll get may or may not depend on
- Video card's brand and chipset
- driver version
- OS type and version
- available memory of all sorts

And finally, one cannot say "OpenGL's a bad platform for benchmarking". Maybe that's exactly what he is up to: benchmarking OpenGL implementation performance ?

Erik Faye-Lund

May 09, 2005, 05:44 AM

I'd like you to pay extremely good notice to the part that saya "in that case". i'm not saying opengl is a bad platform for benchmarking, it's a bad platform for benchmarking vram-writes. this is because the benchmark cannot know when the actual write happens. the thing is, any additional memory-transfer to the actual writing of the data (from the application-side) isn't specified in the standard. i also feel i expressed quite damn clearly that if it only was a matter of benchmarkin a given handset of driver/card-combinations, this won't be an issue.


May 09, 2005, 11:25 AM

You quite damn need to calm down. I didn't mean any offense.


May 09, 2005, 11:28 AM

but if chris wasn't bitching about how stupid people are, he wouldn't have anything to say :)


May 09, 2005, 11:57 AM

I can't remember telling people around here that they're stupid (save for the recent one in the other thread who explicitely asked for it, granted :-)

And I think what I've said was a valid contribution; I pointed out the fact that SOME memory transfer takes place immediately, though it may not be the one expected to take place.

Erik Faye-Lund

May 09, 2005, 01:02 PM

i don't know why you thought i was angry or whatever, i wasn't. i was only trying to clarify what i said. if i came out angry, then i'm sorry about that. anyway. this stuff is in no way relevant to the topic, so lets end the rant, ey? ;)

This thread contains 10 messages.
Hosting by Solid Eight Studios, maker of PhotoTangler Collage Maker.