From a94b251b2d99fa395194f6c1d48a5d29f6dfa238 Mon Sep 17 00:00:00 2001
From: Rye Mutt <rye@alchemyviewer.org>
Date: Mon, 21 Dec 2020 04:30:15 -0500
Subject: [PATCH] Smol opt to occlusion culling from Ansariel

---
 indra/newview/llvieweroctree.cpp | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/indra/newview/llvieweroctree.cpp b/indra/newview/llvieweroctree.cpp
index 6556f36d5df..90668db239d 100644
--- a/indra/newview/llvieweroctree.cpp
+++ b/indra/newview/llvieweroctree.cpp
@@ -1107,9 +1107,10 @@ void LLOcclusionCullingGroup::checkOcclusion()
 
 				static LLCachedControl<bool> wait_for_query(gSavedSettings, "RenderSynchronousOcclusion", true);
 
-				if (wait_for_query && mOcclusionIssued[LLViewerCamera::sCurCameraID] < gFrameCount)
+				U32 target_read_frame = !gGLManager.mIsIntel ? ((gFrameCount > 2) ? (gFrameCount - 2) : 0) : gFrameCount;
+				if (wait_for_query && mOcclusionIssued[LLViewerCamera::sCurCameraID] < target_read_frame)
 				{ //query was issued last frame, wait until it's available
-					S32 max_loop = 1024;
+					S32 max_loop = !gGLManager.mIsIntel ? 64 : 1024;
 					LL_RECORD_BLOCK_TIME(FTM_OCCLUSION_WAIT);
 					while (!available && max_loop-- > 0)
 					{
-- 
GitLab