Re: [osg-users] PBOs and stutterless texture uploading

2010-10-07 Thread Eduard - Gabriel Munteanu

Ulrich Hertlein wrote:
 Hi Eduard,
 
 On 28/09/10 6:08 , Eduard - Gabriel Munteanu wrote:
 
  I've been investigating an issue in Flightgear, an OSS flight sim using
  OSG. We have lots of stutter, usually in multiplayer, caused by loading
  new models (this happens whenever somebody join). Loading textures from
  disk happens on another thread (via DatabasePager), but I traced the
  issue to glTexImage2D() calls. So it's texture uploading to graphics
  driver / card that's causing it. It's not uncommon to see delays of
  300ms for 500KiB - 1MiB textures.
  
 
 Did you try to enable object pre-compiling on the DatabasePager thread via
 'DatabasePager::setDoPreCompile(true)'?
 
 /ulrich
 
 


Thanks for your reply and sorry for the delay, I've been a bit busy.

Yes, I tried setting precompiling on through both environment variables and 
code. It didn't help. :(

Here's some more information. I'm using OSG from SVN revision 11785 (quite 
recent) on a Linux system, although other 2.9.x releases I tried exhibit the 
same problem. I use the latest Catalyst drivers for my graphics card.

My hunch is somehow the card/driver doesn't like the pixel format in those 
textures and it's doing some internal conversions (e.g. RGB - RGBA). Geometry 
data doesn't seem to be a bottleneck here, and I'm not sure if precompiling 
helps at all.

So if I could make use of PBOs, DMA and loading would happen asynchronously and 
the problem would go away. I don't mind if those parts of the scene graph get 
rendered 5-10 seconds later as long as it doesn't cause stutter. It would also 
remove any smaller stutters and improve framerate.

On the other hand, I can't really go and fix up all textures in the data 
tree, even if there was a format that could improve the situation.

Any thoughts on how to get this done?

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=32513#32513





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] PBOs and stutterless texture uploading

2010-10-07 Thread Robert Osfield
Hi Eduard,

The use of PBO may well help, but only if the pixel formats are
accelerated properly by the driver, this can be a bit of lottery.

It just so happens that my recent work on integrating GLU
implementations directly into the core OSG has been prompted by the
wish to pre-process imagery into a form that is better for downloading
to the graphics card.  I will be tweaking the gluScaleImage function
to enable us to call it from any thread, rather being restricted to
just threads with a valid graphics context, this opens the door to
resizing, altering pixel formats and generating mipmaps all in normal
CPU threads, such as parts threads that are loading data.

Another step along this route I plan to integrate the
NvidiaTextureTools SDK into a plugin to allow us to compress imagery
to GL friendly compressed pixel formats, again this can be done as
runtime pre-processing step so that all the data is a form that is
ideal for downloading to the GPU and minimizing memory footprint and
bandwidth.

This will all be part of the next dev release, 2.9.10, and the up
coming 3.0 release.

Robert.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] PBOs and stutterless texture uploading

2010-09-29 Thread Ulrich Hertlein
Hi Eduard,

On 28/09/10 6:08 , Eduard - Gabriel Munteanu wrote:
 I've been investigating an issue in Flightgear, an OSS flight sim using
 OSG. We have lots of stutter, usually in multiplayer, caused by loading
 new models (this happens whenever somebody join). Loading textures from
 disk happens on another thread (via DatabasePager), but I traced the
 issue to glTexImage2D() calls. So it's texture uploading to graphics
 driver / card that's causing it. It's not uncommon to see delays of
 300ms for 500KiB - 1MiB textures.

Did you try to enable object pre-compiling on the DatabasePager thread via
'DatabasePager::setDoPreCompile(true)'?

/ulrich
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] PBOs and stutterless texture uploading

2010-09-27 Thread Eduard - Gabriel Munteanu
Hi,

I've been investigating an issue in Flightgear, an OSS flight sim using
OSG. We have lots of stutter, usually in multiplayer, caused by loading
new models (this happens whenever somebody join). Loading textures from
disk happens on another thread (via DatabasePager), but I traced the
issue to glTexImage2D() calls. So it's texture uploading to graphics
driver / card that's causing it. It's not uncommon to see delays of
300ms for 500KiB - 1MiB textures.

The situation is quite bad. I'm using an ATI Radeon HD5850, and I
generally get 30fps with maxed out shader/details settings in
Flightgear and 8x-ish antialiasing added. But seconds-long stutter,
under practically all combinations of settings, is unacceptable for a
flight simulator.

I'm not an OpenGL expert at all (quite the contrary), but it seems using
PBOs might alleviate this issue by doing DMA instead of hogging the CPU
for texture transfer. There's the other solution of compressing
textures, but it's not a really viable option given what we have so far,
and I'm unsure that's the right fix even if performance does seem to
improve. We're using AC3D models, and the ac3d plugin loads both
geometry and textures.

However, I'm having difficulties setting up PBOs reliably. I attempted
hacking the ac3d plugin and its TextureData class to hardcode PBO usage
in the setTexture() method. Here are my attempts:

1) mImage-setPixelBufferObject(new osg::PixelBufferObject(mImage));
   The PBO is set up, applyTexImage2D_load() finds it, but OSG crashes
because GLBufferObject::getOffset() returns 0.

2) Creating another image object, setting up a PBO on it, cloning
relevant properties from mImage, then doing copySubImage() from the
previous mImage. I also tried doing Image::allocateImage() on it before
copying. But either copySubImage() segfaults in GLU calls, or I hit the
first problem again.

3) By some combination of luck and a typo I made in 2 above (reversing
some coordinates) I got some textures showing up with wrong colors. It
seems to be faster at first glance, but it still crashes at some point.

What am I doing wrong?

Indeed, hacking the plugin doesn't seem the best option, I was just
doing that to test. I suppose, though I'm unsure if it's possible, I
should iterate over the whole scene graph using the visitor pattern and
set up PBOs for every texture.

I'm a bit puzzled there's no simple way to just switch this on. What
would you recommend? Any advice is appreciated.


Thanks,
Eduard

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=32112#32112





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org