From 02d3c097e4e0074cf17fa022f39050c0a5cae9fa Mon Sep 17 00:00:00 2001 From: Paul MARTZ Date: Tue, 16 Sep 2008 17:16:01 +0000 Subject: [PATCH] Merged revisions 8795 and 8796 from trunk. This is the workaround for occlusion query on NVIDIA plus the cmake interface to enable it. Also bumped the rev to 2.6.1 in anticipation of upcoming branch release. --- CMakeLists.txt | 11 +++++++++++ include/osg/Version | 2 +- src/osg/OcclusionQueryNode.cpp | 13 +++++++++++++ 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index bdc72b956..0c6e20643 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -269,6 +269,17 @@ IF(PKG_CONFIG_FOUND) ENDIF(PKG_CONFIG_FOUND) + +# +# Enable workaround for OpenGL driver crash with occlusion query +# +OPTION(OSG_FORCE_QUERY_RESULT_AVAILABLE_BEFORE_RETRIEVAL "Set to ON to build OcclussionQueryNode with a workaround for multi-threaded OpenGL driver occlussion query crash. " OFF) +IF(OSG_FORCE_QUERY_RESULT_AVAILABLE_BEFORE_RETRIEVAL) + ADD_DEFINITIONS(-DFORCE_QUERY_RESULT_AVAILABLE_BEFORE_RETRIEVAL) +ENDIF(OSG_FORCE_QUERY_RESULT_AVAILABLE_BEFORE_RETRIEVAL) + + + # # Test to determine if we want the "tripledot" form of the GLU tesselator callback. # diff --git a/include/osg/Version b/include/osg/Version index 46d4d9294..32ef5e2eb 100644 --- a/include/osg/Version +++ b/include/osg/Version @@ -21,7 +21,7 @@ extern "C" { #define OPENSCENEGRAPH_MAJOR_VERSION 2 #define OPENSCENEGRAPH_MINOR_VERSION 6 -#define OPENSCENEGRAPH_PATCH_VERSION 0 +#define OPENSCENEGRAPH_PATCH_VERSION 1 #define OPENSCENEGRAPH_SOVERSION 44 /** diff --git a/src/osg/OcclusionQueryNode.cpp b/src/osg/OcclusionQueryNode.cpp index 7666c01b9..c99ebdfd1 100644 --- a/src/osg/OcclusionQueryNode.cpp +++ b/src/osg/OcclusionQueryNode.cpp @@ -232,6 +232,19 @@ struct RetrieveQueriesCallback : public osg::Camera::DrawCallback osg::notify( osg::DEBUG_INFO ) << "osgOQ: RQCB: Retrieving..." << std::endl; +#ifdef FORCE_QUERY_RESULT_AVAILABLE_BEFORE_RETRIEVAL + + // Should not need to do this, but is required on some platforms to + // work aroung issues in the device driver. For example, without this + // code, we've seen crashes on 64-bit Mac/Linux NVIDIA systems doing + // multithreaded, multipipe rendering (as in a CAVE). + GLint ready( 0 ); + while( !ready ) + { + ext->glGetQueryObjectiv( tr->_id, GL_QUERY_RESULT_AVAILABLE, &ready ); + }; +#endif + ext->glGetQueryObjectiv( tr->_id, GL_QUERY_RESULT, &(tr->_numPixels) ); if (tr->_numPixels < 0) osg::notify( osg::WARN ) << "osgOQ: RQCB: " <<