diff --git a/indra/newview/llreflectionmap.cpp b/indra/newview/llreflectionmap.cpp
index fb934da02ed0abc90d0f1b451e5a04b8dbdc61e8..37ad74e54ddd84114f997c4dff70abbabbc32423 100644
--- a/indra/newview/llreflectionmap.cpp
+++ b/indra/newview/llreflectionmap.cpp
@@ -41,6 +41,14 @@ LLReflectionMap::LLReflectionMap()
 {
 }
 
+LLReflectionMap::~LLReflectionMap()
+{
+    if (mOcclusionQuery)
+    {
+        glDeleteQueries(1, &mOcclusionQuery);
+    }
+}
+
 void LLReflectionMap::update(U32 resolution, U32 face)
 {
     LL_PROFILE_ZONE_SCOPED_CATEGORY_DISPLAY;
@@ -276,18 +284,21 @@ void LLReflectionMap::doOcclusion(const LLVector4a& eye)
     
     if (mOcclusionQuery == 0)
     { // no query was previously issued, allocate one and issue
+        LL_PROFILE_ZONE_NAMED_CATEGORY_PIPELINE("rmdo - glGenQueries");
         glGenQueries(1, &mOcclusionQuery);
         do_query = true;
     }
     else
     { // query was previously issued, check it and only issue a new query
         // if previous query is available
-        GLuint result = (GLuint) 0xFFFFFFFF;
-        glGetQueryObjectuiv(mOcclusionQuery, GL_QUERY_RESULT_NO_WAIT, &result);
+        LL_PROFILE_ZONE_NAMED_CATEGORY_PIPELINE("rmdo - glGetQueryObject");
+        GLuint result = 0;
+        glGetQueryObjectuiv(mOcclusionQuery, GL_QUERY_RESULT_AVAILABLE, &result);
 
-        if (result != (GLuint) 0xFFFFFFFF)
+        if (result > 0)
         {
             do_query = true;
+            glGetQueryObjectuiv(mOcclusionQuery, GL_QUERY_RESULT, &result);
             mOccluded = result == 0;
             mOcclusionPendingFrames = 0;
         }
@@ -299,6 +310,7 @@ void LLReflectionMap::doOcclusion(const LLVector4a& eye)
 
     if (do_query)
     {
+        LL_PROFILE_ZONE_NAMED_CATEGORY_PIPELINE("rmdo - push query");
         glBeginQuery(GL_ANY_SAMPLES_PASSED, mOcclusionQuery);
 
         LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr;
diff --git a/indra/newview/llreflectionmap.h b/indra/newview/llreflectionmap.h
index 0405d06eb507cea9c87a62da65186426a91dd16e..6eff607ea5faaee8b8e01d881f53dda70b354219 100644
--- a/indra/newview/llreflectionmap.h
+++ b/indra/newview/llreflectionmap.h
@@ -39,6 +39,8 @@ class alignas(16) LLReflectionMap : public LLRefCount
     // allocate an environment map of the given resolution 
     LLReflectionMap();
 
+    ~LLReflectionMap();
+
     // update this environment map
     // resolution - size of cube map to generate
     void update(U32 resolution, U32 face);
diff --git a/indra/newview/llreflectionmapmanager.cpp b/indra/newview/llreflectionmapmanager.cpp
index bfc8b595c2c8a5789f1136aa602c02ae7936fc3a..608585acf51b1bfc1ff6cbc511adf47074bb63fc 100644
--- a/indra/newview/llreflectionmapmanager.cpp
+++ b/indra/newview/llreflectionmapmanager.cpp
@@ -862,7 +862,7 @@ void LLReflectionMapManager::updateUniforms()
                 }
 
                 GLint idx = neighbor->mProbeIndex;
-                if (idx == -1)
+                if (idx == -1 || neighbor->mOccluded)
                 {
                     continue;
                 }