Discussion:
[osg-users] Vertex Buffer Object used inside display list
Jannik Heller
2017-02-16 21:14:43 UTC
Permalink
Hi,

I've noticed some odd API usage in the OSG that seems to have started with the VAO support changes in OSG 3.5. Vertex buffer objects are being used inside a display list. This happens on a standard Geometry with default settings. Example:

glNewList(6, GL_COMPILE)
glGenBuffers(1, [5])
glBindBuffer(GL_ARRAY_BUFFER, 5)
glBufferData(...)
glBufferSubData(...) x4
glVertexPointer(3, GL_FLOAT, 0, NULL)
glNormalPointer(GL_FLOAT, 0, 0x90)
glColorPointer(4, GL_FLOAT, 0x180)
glTexCoordPointer(2, GL_FLOAT, 0, 0x120)
glDrawElements(...)
glBindBuffer(GL_ARRAY_BUFFER, 0)
glEndList()

The source of this change in behavior is here: https://github.com/openscenegraph/OpenSceneGraph/blob/master/src/osg/Geometry.cpp#L187 OSG will now always assign VBOs, even if they weren't requested.

First off all I find this usage very odd. The GL standard doesn't actually specify what is supposed to happen to VBOs in a display list - is the VBO simply ignored or could that cause a new VBO to be created with every call to the display list? Even if this works, the calls are completely redundant and could be removed.

More importantly, though, and the reason I'm bringing it up, is that this usage seems to be causing a crash with some versions of Mesa drivers, and the crash goes away when I disable display lists.

Ubuntu 14.04 - Nvidia: works
Ubuntu 14.04 - Intel HD: broken
Ubuntu 16.04 - Intel HD: broken

I've attached a minimal-ish apitrace you can use to see if your driver is affected - run it with 'apitrace replay <file>' , if you get 'caught signal 11' that means the driver has crashed.

Cheers,
Jannik

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=70219#70219
Jannik Heller
2017-02-16 21:24:46 UTC
Permalink
On Nvidia, replaying the trace prints the following debug output for each 'glDrawElements' line:


Code:
usnknown (sic) severity API unknown issue 131185, Buffer detailed info: Buffer object 1 (bound to GL_VERTEX_ARRAY_BUFFER_BINDING_ARB, GL_TEXCOORD_ARRAY_BUFFER_BINDING_ARB (0), and GL_ARRAY_BUFFER_ARB, usage hint is GL_STATIC_DRAW) will use VIDEO memory as the source for buffer object operations.




Not sure what this means exactly but I'd guess the VBO is first uploaded to the graphics card, then downloaded again to later re-upload into the display list? That sounds like while Nvidia accepts this behavior, it isn't recommending it from a performance standpoint.

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=70220#70220
Robert Osfield
2017-02-17 09:20:08 UTC
Permalink
Hi Jannik,

I had to change the code to always assign a VertexBufferObject as I
couldn't find a way of implementing VAO without forcing changes to
client code, in order to make sure the OSG works on GLcore profile
implementations that require VAO all arrays have to have a
VertexBufferObject.

The observation that display lists are being used the VBO side shows a
bug, display lists and VBO shouldn't be invoked though, we'll need to
review osg::Geometry to make sure VBO's aren't used when display lists
are being generated..

Robert.
Post by Jannik Heller
Hi,
glNewList(6, GL_COMPILE)
glGenBuffers(1, [5])
glBindBuffer(GL_ARRAY_BUFFER, 5)
glBufferData(...)
glBufferSubData(...) x4
glVertexPointer(3, GL_FLOAT, 0, NULL)
glNormalPointer(GL_FLOAT, 0, 0x90)
glColorPointer(4, GL_FLOAT, 0x180)
glTexCoordPointer(2, GL_FLOAT, 0, 0x120)
glDrawElements(...)
glBindBuffer(GL_ARRAY_BUFFER, 0)
glEndList()
The source of this change in behavior is here: https://github.com/openscenegraph/OpenSceneGraph/blob/master/src/osg/Geometry.cpp#L187 OSG will now always assign VBOs, even if they weren't requested.
First off all I find this usage very odd. The GL standard doesn't actually specify what is supposed to happen to VBOs in a display list - is the VBO simply ignored or could that cause a new VBO to be created with every call to the display list? Even if this works, the calls are completely redundant and could be removed.
More importantly, though, and the reason I'm bringing it up, is that this usage seems to be causing a crash with some versions of Mesa drivers, and the crash goes away when I disable display lists.
Ubuntu 14.04 - Nvidia: works
Ubuntu 14.04 - Intel HD: broken
Ubuntu 16.04 - Intel HD: broken
I've attached a minimal-ish apitrace you can use to see if your driver is affected - run it with 'apitrace replay <file>' , if you get 'caught signal 11' that means the driver has crashed.
Cheers,
Jannik
------------------
http://forum.openscenegraph.org/viewtopic.php?p=70219#70219
_______________________________________________
osg-users mailing list
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Loading...