summaryrefslogtreecommitdiff
path: root/indra/newview/llvieweroctree.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llvieweroctree.cpp')
-rw-r--r--indra/newview/llvieweroctree.cpp27
1 files changed, 26 insertions, 1 deletions
diff --git a/indra/newview/llvieweroctree.cpp b/indra/newview/llvieweroctree.cpp
index a1c2e0f9ff..4f6641f30d 100644
--- a/indra/newview/llvieweroctree.cpp
+++ b/indra/newview/llvieweroctree.cpp
@@ -1136,13 +1136,24 @@ void LLOcclusionCullingGroup::checkOcclusion()
}
static LLCachedControl<U32> occlusion_timeout(gSavedSettings, "RenderOcclusionTimeout", 4);
+ const bool timed_out = mOcclusionCheckCount[LLViewerCamera::sCurCameraID] > occlusion_timeout;
- if (available || mOcclusionCheckCount[LLViewerCamera::sCurCameraID] > occlusion_timeout)
+ // Apple's GL thread segfaults in glGetQueryObject_CoreExecThread
+ // if GL_QUERY_RESULT blocks after the app was backgrounded and the
+ // query never becomes available. Drop the query instead of waiting.
+#if LL_DARWIN
+ const bool read_result = available != 0;
+#else
+ const bool read_result = available || timed_out;
+#endif
+ if (read_result)
{
mOcclusionCheckCount[LLViewerCamera::sCurCameraID] = 0;
GLuint query_result; // Will be # samples drawn, or a boolean depending on mHasOcclusionQuery2 (both are type GLuint)
{
LL_PROFILE_ZONE_NAMED_CATEGORY_OCTREE("co - query result");
+ // Ping watchdog before a blocking GL_QUERY_RESULT GPU call
+ LLAppViewer::instance()->pingMainloopTimeout("Display:CullQueryResult");
glGetQueryObjectuiv(mOcclusionQuery[LLViewerCamera::sCurCameraID], GL_QUERY_RESULT, &query_result);
}
#if LL_TRACK_PENDING_OCCLUSION_QUERIES
@@ -1159,6 +1170,20 @@ void LLOcclusionCullingGroup::checkOcclusion()
}
clearOcclusionState(QUERY_PENDING);
}
+#if LL_DARWIN
+ else if (timed_out)
+ {
+ GLuint name = mOcclusionQuery[LLViewerCamera::sCurCameraID];
+#if LL_TRACK_PENDING_OCCLUSION_QUERIES
+ sPendingQueries.erase(name);
+#endif
+ glDeleteQueries(1, &name);
+ mOcclusionQuery[LLViewerCamera::sCurCameraID] = 0;
+ mOcclusionCheckCount[LLViewerCamera::sCurCameraID] = 0;
+ clearOcclusionState(LLOcclusionCullingGroup::OCCLUDED, LLOcclusionCullingGroup::STATE_MODE_DIFF);
+ clearOcclusionState(QUERY_PENDING);
+ }
+#endif
}
}
else if (mSpatialPartition->isOcclusionEnabled() && isOcclusionState(LLOcclusionCullingGroup::OCCLUDED))