From 0e9fb587fa267a296183b0d2093700e5fb53c950 Mon Sep 17 00:00:00 2001
From: ruslantproductengine <ruslantproductengine@lindenlab.com>
Date: Mon, 18 Sep 2017 21:02:53 +0300
Subject: [PATCH] MAINT-7813 - 3D rendering broken on Windows in build 508618.
 3D rendering starts before 2D login screen is cleared. FIXED

---
 indra/llrender/llshadermgr.cpp | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/indra/llrender/llshadermgr.cpp b/indra/llrender/llshadermgr.cpp
index 07356940f1d..e721ad93fa1 100644
--- a/indra/llrender/llshadermgr.cpp
+++ b/indra/llrender/llshadermgr.cpp
@@ -779,11 +779,13 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade
 	
 	unsigned char flags = flag_write_to_out_of_extra_block_area;
 	
-	GLuint out_of_extra_block_counter = 0, start_shader_code = shader_code_count;
+	GLuint out_of_extra_block_counter = 0, start_shader_code = shader_code_count, file_lines_count = 0;
 	
 	while(NULL != fgets((char *)buff, 1024, file)
 		  && shader_code_count < (LL_ARRAY_SIZE(shader_code_text) - LL_ARRAY_SIZE(extra_code_text)))
 	{
+		file_lines_count++;
+
 		bool extra_block_area_found = NULL != strstr((const char*)buff, "[EXTRA_CODE_HERE]");
 		
 		if(extra_block_area_found && !(flag_extra_block_marker_was_found & flags))
@@ -840,6 +842,11 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade
 			shader_code_text[n] = extra_code_text[n - start_shader_code];
 		}
 		
+		if (file_lines_count < extra_code_count)
+		{
+			shader_code_count += extra_code_count;
+		}
+
 		extra_code_count = 0;
 	}
 
-- 
GitLab