View Full Version : VBO and threads

Roman Grigoriev
06-21-2004, 10:12 PM
Hi guys!
I have GFX5950ultra, 53.36 linux drivers
I found VBO problem related to threaded situation when one thread draw one VBO and another try to create VBO when tile loads
maybe someone knows solution for this situation?
here is gdb output
#0 0x40167a8e in glGenBuffersARB () from /usr/lib/tls/libGL.so.1
#1 0x083fa0ae in ssgVtxTable (this=0xb586e68, ty=6, vl=0xb58ac68, nl=0xb558d10, tl=0xb58af10, cl=0xb58aec0) at ssgVtxTable.cxx:224
#2 0x08358872 in sgMakeLeaf(std::string const&, unsigned, SGMaterialLib*, std::string const&, std::vector<Point3D, std::allocator<Point3D> > const&, std::vector<Point3D, std::allocator<Point3D> > const&, std::vector<Point3D, std::allocator<Point3D> > const&, std::vector<int, std::allocator<int> > const&, std::vector<int, std::allocator<int> > const&, std::vector<int, std::allocator<int> > const&, bool, ssgVertexArray*) (path=@0x4a7e3810, ty=6,
matlib=0x92347f0, material=@0xb58a2a8, nodes=@0x4a7e3410, normals=@0x4a7e3428, texcoords=@0x4a7e3434, node_index=@0xb58afa8,
normal_index=@0xb58c7b0, tex_index=@0xb58dfb8, calc_lights=true, lights=0xb544500) at leaf.cxx:249
#3 0x0835aa28 in sgBinObjLoad(std::string const&, bool, Point3D*, double*, SGMaterialLib*, bool, ssgBranch*, ssgBranch*, ssgBranch*, ssgBranch*, ssgVertexArray*) (path=@0x4a7e3810, is_base=true, center=0x4a7e3590, bounding_radius=0x4a7e3588, matlib=0x92347f0, use_random_objects=true,
geometry=0xb550ac8, vasi_lights=0x0, rwy_lights=0x0, taxi_lights=0x0, ground_lights=0xb544500) at obj.cxx:484
#4 0x082c94b7 in FGTileEntry::obj_load(std::string const&, ssgBranch*, ssgBranch*, ssgBranch*, ssgBranch*, ssgVertexArray*, bool) (this=0xb531130,
path=@0x4a7e3810, geometry=0xb550ac8, vasi_lights=0x0, rwy_lights=0x0, taxi_lights=0x0, ground_lights=0xb544500, is_base=true) at globals.hxx:264
#5 0x082c9c1f in FGTileEntry::load(std::vector<std::string, std::allocator<std::string> > const&, bool) (this=0xb531130, path_list=@0x8e30fec)
at sg_path.hxx:122
#6 0x082c1098 in FGTileLoader::LoaderThread::run() (this=0x8e31048) at FGTileLoader.cxx:172
#7 0x083c8a5f in start_handler (arg=0x8e31048) at SGThread.cxx:23
#8 0x4002d7d3 in start_thread () from /lib/tls/libpthread.so.0
#9 0x40553b4a in clone () from /lib/tls/libc.so.6

06-21-2004, 10:34 PM
You must protect gl context when two threads try to access to it. If you already do this, then bug might be somewhere in driver (in VBO setup). Try this solution:
- First thread have access to gl context and render.
In render loop check for any pending notification and process them.
- Second thread load geometry, textures,... and notify first thread to create VBO or upload texture.