From 7d0903533c20a395e12c2d4c290fcde3ec6b2a53 Mon Sep 17 00:00:00 2001
From: Cosmic Linden <cosmic@lindenlab.com>
Date: Thu, 11 May 2023 11:31:09 -0700
Subject: [PATCH] SL-19236: Fix HUDs not rendering when transparent water
 graphics setting is off

---
 indra/newview/lldrawpoolalpha.cpp | 2 +-
 indra/newview/pipeline.cpp        | 8 +++++++-
 indra/newview/pipeline.h          | 2 ++
 3 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/indra/newview/lldrawpoolalpha.cpp b/indra/newview/lldrawpoolalpha.cpp
index ec57e20d359..f8d2a9e942e 100644
--- a/indra/newview/lldrawpoolalpha.cpp
+++ b/indra/newview/lldrawpoolalpha.cpp
@@ -157,7 +157,7 @@ void LLDrawPoolAlpha::renderPostDeferred(S32 pass)
 { 
     LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL;
 
-    if ((!LLPipeline::sRenderTransparentWater || gCubeSnapshot) && getType() == LLDrawPool::POOL_ALPHA_PRE_WATER)
+    if (LLPipeline::isWaterClip() && getType() == LLDrawPool::POOL_ALPHA_PRE_WATER)
     { // don't render alpha objects on the other side of the water plane if water is opaque
         return;
     }
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index 4d9a8a594a7..73e568f1ae2 100644
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -2239,12 +2239,18 @@ bool LLPipeline::getVisibleExtents(LLCamera& camera, LLVector3& min, LLVector3&
 
 static LLTrace::BlockTimerStatHandle FTM_CULL("Object Culling");
 
+// static
+bool LLPipeline::isWaterClip()
+{
+	return (!sRenderTransparentWater || gCubeSnapshot) && !sRenderingHUDs;
+}
+
 void LLPipeline::updateCull(LLCamera& camera, LLCullResult& result)
 {
     LL_PROFILE_ZONE_SCOPED_CATEGORY_PIPELINE; //LL_RECORD_BLOCK_TIME(FTM_CULL);
     LL_PROFILE_GPU_ZONE("updateCull"); // should always be zero GPU time, but drop a timer to flush stuff out
 
-    bool water_clip = !sRenderTransparentWater && !sRenderingHUDs;
+	bool water_clip = isWaterClip();
 
     if (water_clip)
     {
diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h
index e92fa32fc61..7eede30d8fb 100644
--- a/indra/newview/pipeline.h
+++ b/indra/newview/pipeline.h
@@ -376,6 +376,8 @@ class LLPipeline
 	bool hasRenderType(const U32 type) const;
 	bool hasAnyRenderType(const U32 type, ...) const;
 
+	static bool isWaterClip();
+
 	void setRenderTypeMask(U32 type, ...);
 	// This is equivalent to 'setRenderTypeMask'
 	//void orRenderTypeMask(U32 type, ...);
-- 
GitLab