From 40b8ef2607621897edc7eb038e63ad57ae24059a Mon Sep 17 00:00:00 2001
From: Rye Mutt <rye@alchemyviewer.org>
Date: Wed, 14 Jul 2021 11:19:01 -0400
Subject: [PATCH] Check for ARB_clip_control extension support

---
 indra/llrender/llgl.cpp | 6 +++++-
 indra/llrender/llgl.h   | 5 +++--
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/indra/llrender/llgl.cpp b/indra/llrender/llgl.cpp
index 631cfff2b0d..38dc95f044d 100644
--- a/indra/llrender/llgl.cpp
+++ b/indra/llrender/llgl.cpp
@@ -182,6 +182,7 @@ LLGLManager::LLGLManager() :
 
 	mHasTextureSwizzle(false),
     mHasGPUShader4(false),
+    mHasClipControl(false),
 	mIsATI(FALSE),
 	mIsNVIDIA(FALSE),
 	mIsIntel(FALSE),
@@ -745,7 +746,8 @@ void LLGLManager::asLLSD(LLSD& info)
 	info["has_srgb_texture"] = mHassRGBTexture;
 	info["has_srgb_framebuffer"] = mHassRGBFramebuffer;
     info["has_texture_srgb_decode"] = mHasTexturesRGBDecode;
-    info["has_gpu_shader_4"] = mHasGPUShader4;
+    info["has_gpu_shader4"] = mHasGPUShader4;
+    info["has_clip_control"] = mHasClipControl;
 
 	// Vendor-specific extensions
 	info["is_ati"] = mIsATI;
@@ -894,6 +896,7 @@ void LLGLManager::initExtensions()
 
 	mHasTextureSwizzle = mGLVersion >= 3.3f || epoxy_has_gl_extension("GL_ARB_texture_swizzle");
     mHasGPUShader4 = mGLVersion >= 3.0f || epoxy_has_gl_extension("GL_EXT_gpu_shader4");
+    mHasClipControl = mGLVersion >= 4.5 || epoxy_has_gl_extension("GL_ARB_clip_control");
 #endif
 
 #if LL_LINUX
@@ -921,6 +924,7 @@ void LLGLManager::initExtensions()
 		mHasFragmentShader = FALSE;
 		mHasTextureSwizzle = FALSE;
         mHasGPUShader4 = FALSE;
+        mHasClipControl = FALSE;
 		LL_WARNS("RenderInit") << "GL extension support DISABLED via LL_GL_NOEXT" << LL_ENDL;
 	}
 	else if (getenv("LL_GL_BASICEXT"))	/* Flawfinder: ignore */
diff --git a/indra/llrender/llgl.h b/indra/llrender/llgl.h
index 5043627e2a8..5aba19aafb5 100644
--- a/indra/llrender/llgl.h
+++ b/indra/llrender/llgl.h
@@ -129,8 +129,9 @@ class LLGLManager
 	BOOL mHassRGBTexture;
 	BOOL mHassRGBFramebuffer;
     BOOL mHasTexturesRGBDecode;
-	bool mHasTextureSwizzle;
-    bool mHasGPUShader4;
+    bool mHasTextureSwizzle = false;
+    bool mHasGPUShader4  = false;
+    bool mHasClipControl = false;
 
 	// Vendor-specific extensions
 	BOOL mIsATI;
-- 
GitLab