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: " <<