From 1e062c8151d1615ca0768c312de5ee9d55895959 Mon Sep 17 00:00:00 2001
From: Rye Mutt <rye@alchemyviewer.org>
Date: Mon, 13 Sep 2021 00:46:10 -0400
Subject: [PATCH] Add logging to colorgrade setup

---
 indra/newview/alrenderutils.cpp | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/indra/newview/alrenderutils.cpp b/indra/newview/alrenderutils.cpp
index 01c87764c27..07bd2514a2f 100644
--- a/indra/newview/alrenderutils.cpp
+++ b/indra/newview/alrenderutils.cpp
@@ -228,13 +228,16 @@ bool ALRenderUtil::setupColorGrade()
 						break;
 					}
 					default:
+					{
+						LL_WARNS() << "Color LUT has invalid number of color components: " << raw_image->getComponents() << LL_ENDL;
 						return true;
+					}
 					};
 
 					S32 image_height = raw_image->getHeight();
 					S32 image_width = raw_image->getWidth();
-					if ((image_height > 0 && image_height <= 64)	   // within dimension limit
-						&& !(image_height & (image_height - 1))			   // height is power of 2
+					if ((image_height > 0 && image_height <= 64)		   // within dimension limit
+						&& ((image_height & (image_height - 1)) == 0)	   // height is power of 2
 						&& ((image_height * image_height) == image_width)) // width is height * height
 					{
 						mCGLutSize = LLVector4(1.f / image_width, 1.f / image_height, (F32)image_width, (F32)image_height);
@@ -247,6 +250,14 @@ bool ALRenderUtil::setupColorGrade()
 						gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_BILINEAR);
 						gGL.getTexUnit(0)->setTextureAddressMode(LLTexUnit::TAM_CLAMP);
 					}
+					else
+					{
+						LL_WARNS() << "Color LUT is invalid width or height: " << image_height << " x " << image_width << LL_ENDL;
+					}
+				}
+				else
+				{
+					LL_WARNS() << "Failed to decode color grading LUT with extension: " << temp_exten << LL_ENDL;
 				}
 			}
 		}
-- 
GitLab