FBO causes my VBO to crash

I’m just trying to get FBO to work. Everything seems to work fine, I can attach textures, renderbuffers, etc… I check the FBO status and it says framebuffer is complete. I don’t render anything, just bind back the default framebuffer (just testing). After this, my next DrawArrays call, which sources its data from a VBO, crashes. Now, if I don’t bind my texture to the framebuffer, then everyhting is fine. I checked for GL errors, but there are none… Any ideas?


On my card, radeon 9800 pro, I have found that it will crash when using DrawElements (regardless of VBO or not) if the DrawElements call comes before binding the framebuffer, even if no rendering is done to it. I was able to stop the crashing by moving all DrawElement calls for the main framebuffer to after FBO drawing code. DrawElements works fine inside FBOs, and I figure it is probably just something that will be fixed in the next driver…

Some more info: it doesn’t matter what I bind to the FBO, the crash happens, whenever I manage to create a valid FBO. If the FBO is not created for some reason (eg. incomplete), then there’s no crash. Also, now I tried to dereference a PBO, to load texture from, after the FBO test, and it works fine… But I have multiple VBOs (which should be the same as the PBO), but rendering from any of them crashes!!

Hah, watch this: if I just glMap() and glUnmap() the VBOs before rendering, then it works again!! This is on GF6600 with 77.72 drivers.

Map/unmap is a pretty big operation. Andras, can you describe in a little more detail what operations you’re performing on your failing VBOs and what FBO operations are required to trigger the failure?

Yeah Map()/Unmap() are pretty heavy. And even though it doesn’t crash, there are some weird stuff going on (sometimes geometry disappears for a moment, stuff like that). Ok, here’s some more detail on what I’m doing (sorry, I have everything wrapped up in objects, but you should get the idea (tu0 is texture unit 0)) :

// setup framebuffer
fbo->AttachTexture(IFrameBuffer::AttachmentPoint::color, l.image);

This triggers the failure (doing nothing). If I don’t attach the texture, then the Check() will fail, as the FBO is incomplete, but then the crash goes away.

Here’s my VBO prep (the Unmap() method internally binds and unbinds):

VertexAttribPointer(location, size, type_convert[type], normalized, stride, (void*)offset);
::glDrawArrays(Convert(primtype), 0, vxcount);

If you need some more info, please let me know!


Ok, I just realized that all the sideffects of the extra Map/Unmap that I’ve seen are normal, since I internally doublebuffer my VBOs, so every Map() switches pages automagically, and that’s why I’ve seen the weird stuff. So this means that Map/Unmap solves the crash without any problems. Of course it’s super expensive, but for now I can live with it…

Ok, so here is my other suspect, even though it is not the direct cause of the crash, it doesn’t work as expected, and might indirectly cause problems:

I want to load a texture from a PBO. Loading the texture works fine, but filling the data does not. If I fill the PBO like this, then it works (ie. the data gets uploaded):


But, if I use Map(), and then copy the data, then the result is an empty buffer (black texture, after upload):

::memcpy(data, image, size);

The reason I want to use Map instead of BufferData, is that I want to fill the data in from a separate thread, and would like to avoid having a temporary buffer to copy from. Anyway, this might, or might not have anything to do with the crash. I’ll keep investigating.

Well, I ruled out the PBOs, it doesn’t have anything to do with the crash, and for now I can live with the workaround, although it still frustrates me why mapping doesn’t work.

So, back to the FBO: I’ve done some measurements:
no FBO, no map/unmap hack: 70fps
no FBO, map/unmap hack: 30fps
FBO, map/unmap hack: 10fps!!!

And the most interesting thing is that the framerate remains low even after I stop executing the FBO path! Now I’ll try to render something into my texture, see if it works at all…

Hah, I’ve found the solution to the FBO crash!!
My driver was set to multi-monitor acceleration. If I turn off acceleration for the second monitor, the crash goes away!! Should I report this somewhere, or do nVidia guys read this forum?

Report it, it is safer :slight_smile: