From c654dac4b7593355a5754042d0b43e03924b3efb Mon Sep 17 00:00:00 2001
From: "Jonathan \"Geenz\" Goodman" <geenz@lindenlab.com>
Date: Tue, 12 Nov 2024 20:58:29 -0500
Subject: #3059 Backport to ExtraFPS. (#3082)

---
 indra/newview/llvovolume.cpp | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

(limited to 'indra/newview/llvovolume.cpp')

diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp
index 253fb01219..b234b5a9af 100644
--- a/indra/newview/llvovolume.cpp
+++ b/indra/newview/llvovolume.cpp
@@ -5862,7 +5862,23 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
                             {
                                 if (gltf_mat != nullptr)
                                 {
-                                    add_face(sPbrFaces, pbr_count, facep);
+                                    // In theory, we should never actually get here with alpha blending.
+                                    // How this is supposed to work is we check if the surface is alpha blended, and we assign it to the
+                                    // alpha draw pool. For rigged meshes, this apparently may not happen consistently. For now, just
+                                    // discard it here if the alpha is 0 (fully transparent) to achieve parity with blinn-phong materials in
+                                    // function.
+                                    bool should_render = true;
+                                    if (gltf_mat->mAlphaMode == LLGLTFMaterial::ALPHA_MODE_BLEND)
+                                    {
+                                        if (gltf_mat->mBaseColor.mV[3] == 0.0f)
+                                        {
+                                            should_render = false;
+                                        }
+                                    }
+                                    if (should_render)
+                                    {
+                                        add_face(sPbrFaces, pbr_count, facep);
+                                    }
                                 }
                                 else
                                 {
-- 
cgit v1.2.3