From 9cd092544f6f4183af19132ed68111bd8d31a89f Mon Sep 17 00:00:00 2001
From: leyla_linden <none@none>
Date: Tue, 8 Feb 2011 15:00:42 -0800
Subject: [PATCH] SH-545 [REGRESSION] Enabled Basic Shaders Can Cause an
 Unrecoverable System Lock Up originally done in
 http://bitbucket.org/leyla/leyla-mesh-development

---
 indra/llrender/llgl.cpp               | 8 ++++++++
 indra/newview/llfloaterpreference.cpp | 9 ++++++---
 2 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/indra/llrender/llgl.cpp b/indra/llrender/llgl.cpp
index 90220262484..f91584b5e42 100644
--- a/indra/llrender/llgl.cpp
+++ b/indra/llrender/llgl.cpp
@@ -671,7 +671,15 @@ void LLGLManager::initExtensions()
 	mHasVertexBufferObject = ExtensionExists("GL_ARB_vertex_buffer_object", gGLHExts.mSysExts);
 	mHasDepthClamp = ExtensionExists("GL_ARB_depth_clamp", gGLHExts.mSysExts) || ExtensionExists("GL_NV_depth_clamp", gGLHExts.mSysExts);
 	// mask out FBO support when packed_depth_stencil isn't there 'cause we need it for LLRenderTarget -Brad
+#ifdef GL_ARB_framebuffer_object
 	mHasFramebufferObject = ExtensionExists("GL_ARB_framebuffer_object", gGLHExts.mSysExts);
+#else
+	mHasFramebufferObject = ExtensionExists("GL_EXT_framebuffer_object", gGLHExts.mSysExts) &&
+							ExtensionExists("GL_EXT_framebuffer_blit", gGLHExts.mSysExts) &&
+							ExtensionExists("GL_EXT_framebuffer_multisample", gGLHExts.mSysExts) &&
+							ExtensionExists("GL_EXT_packed_depth_stencil", gGLHExts.mSysExts);
+#endif
+	
 	mHasDrawBuffers = ExtensionExists("GL_ARB_draw_buffers", gGLHExts.mSysExts);
 	mHasBlendFuncSeparate = ExtensionExists("GL_EXT_blend_func_separate", gGLHExts.mSysExts);
 	mHasTextureRectangle = ExtensionExists("GL_ARB_texture_rectangle", gGLHExts.mSysExts);
diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp
index 92d6d9a486d..3673a28163e 100644
--- a/indra/newview/llfloaterpreference.cpp
+++ b/indra/newview/llfloaterpreference.cpp
@@ -1043,8 +1043,10 @@ void LLFloaterPreference::refreshEnabledState()
 
 	//Deferred/SSAO/Shadows
 	LLCheckBoxCtrl* ctrl_deferred = getChild<LLCheckBoxCtrl>("UseLightShaders");
-	if (LLFeatureManager::getInstance()->isFeatureAvailable("RenderDeferred") &&
-		shaders)
+	
+	if (LLFeatureManager::getInstance()->isFeatureAvailable("RenderDeferred") && 
+		shaders && 
+		gGLManager.mHasFramebufferObject)
 	{
 		BOOL enabled = (ctrl_wind_light->get()) ? TRUE : FALSE;
 
@@ -1127,7 +1129,8 @@ void LLFloaterPreference::disableUnavailableSettings()
 	}
 
 	// disabled deferred
-	if(!LLFeatureManager::getInstance()->isFeatureAvailable("RenderDeferred"))
+	if (!LLFeatureManager::getInstance()->isFeatureAvailable("RenderDeferred") ||
+		!gGLManager.mHasFramebufferObject)
 	{
 		ctrl_shadows->setEnabled(FALSE);
 		ctrl_shadows->setValue(0);
-- 
GitLab