Hi Ulrich,
The updating of a texture's images happen before the image's modified-count is
updated by the dirtying thread. This means that even if a third thread updates
the image in the mean-time, this new update doesn't get missed from being
uploaded to VRAM as the texture-upload happens *after* the modified count is
read into the texture from its image. Therefore the updated texture in VRAM
should reflect the 2nd update as well even if the modified-count is only from
the 1st update. The only drawback I see is that a redundant texture upload
could occur in a future texture apply().
Of course, since textures were not meant for multi-threaded updates, the
application I'm working on uses a central texture container which prevents more
than one DBPager thread from updating the same texture simultaneously. The fix
was only to also synchronize the RenderThread too.
Cheers,
Anish
Ulrich Hertlein wrote:
> Hi Anish,
>
> Looking at the fix I don't think this works in all cases, it only makes it
> less likely to
> occur.
>
> The check and the set are still done non-atomically, so another thread could
> be scheduled
> inbetween and one update would be lost.
>
> My preferred solution would be to use std::atomic with exchange for the
> modifiedCount, but
> I don't know if that's available across all compilers that OSG supports.
> It's been in
> since C++11 though so I would hope it's safe to use.
>
> Cheers,
> /ulrich
>
> On 19/10/17 07:31, Anish Thomas wrote:
>
> > Hi,
> >
> > I've attached the original and the fixed versions of the texture-handling
> > files based on the head of the 3.2 branch.
> >
> > Thank you!
> >
> > Cheers,
> > Anish
> >
>
>
> ___
> osg-submissions mailing list
>
> http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
>
> --
> Post generated by Mail2Forum
--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=72251#72251
___
osg-submissions mailing list
osg-submissions@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org