Hi Paul,

Ack, hate driver issues like this... thanks for chasing it up (Todd and Doug).

The change looks fine, but we'll need to add the define option into
CMakeLists.txt, otherwise users will need to know explictly about this
hack and modify the build system by hand to add the required option.

Robert.

On Mon, Aug 25, 2008 at 4:19 PM, Paul Martz <[EMAIL PROTECTED]> wrote:
> Hi Robert -- I've been involved in an offline discussion / investigation of
> an occlusion query issue with Todd Furlong and Doug McCorkle. Attached is a
> fix for the issue. Please credit Doug with the fix.
>
> Summary: Some platforms/configurations cause application crashes if the
> occlusion query result is not ready for retrieval when the app tries to
> retrieve it. This fix adds an application-level wait loop to ensure the
> result is ready for retrieval. This code is not compiled by default; add "-D
> FORCE_QUERY_RESULT_AVAILABLE_BEFORE_RETRIEVAL" to get this code.
>
> Full, gory details, to the best of my recollection:
>
> The conditions under which we encountered this issue are as follows: 64-bit
> processor, Mac/Linux OS, multiple NVIDIA GPUs, multiple concurrent draw
> threads, VRJuggler/SceneView-based viewer, and a scene graph containing
> OcclusionQueryNodes. Todd wrote a small test program that produces an almost
> instant crash in this environment. We verified the crash does not occur in a
> similar environment with a 32-bit processor, but we have not yet tested on
> Windows and have not yet tested with osgViewer.
>
> The OpenGL spec states clearly that, if an occlusion query result is not yet
> ready, an app can go ahead and attempt to retrieve it, and OpenGL will
> simply block until the result is ready. Indeed, this is how
> OcclusionQueryNode is written, and this has worked fine on several platforms
> and configurations until Todd's test program.
>
> By trial and error and dumb luck, we were able to workaround the crash by
> inserting a wait loop that forces the app to only retrieve the query after
> OpenGL says it is available. As this should not be required (OpenGL should
> do this implicitly, and more efficiently), the wait loop code is not
> compiled by default. Developers requiring this work around must explicitly
> add "-D FORCE_QUERY_RESULT_AVAILABLE_BEFORE_RETRIEVAL" to the compile
> options to include the wait loop.
>
> Both Doug and Todd report that this change eliminates the crash and allows
> their applications to run on the platform/config described above.
>
> Doug wants to port to OSG 2.6 but requires this fix, so we'll need to add it
> to the branch and work towards a 2.6.1 release in the near future. I'll be
> happy to take that on.
>
> Thanks,
>
> Paul Martz
> Skew Matrix Software LLC
> http://www.skew-matrix.com <http://www.skew-matrix.com/>
> +1 303 859 9466
>
> _______________________________________________
> osg-submissions mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
>
>
_______________________________________________
osg-submissions mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org

Reply via email to