From 2ac1fe03e85b6b81076a4cfff86ee2ef5af178c4 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Tue, 21 Jun 2011 16:11:04 -0500 Subject: SH-1838 Fix for black screen when enabling lighting and shadows on an ATI machine. --- indra/llrender/llgl.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'indra/llrender') diff --git a/indra/llrender/llgl.cpp b/indra/llrender/llgl.cpp index a3aed4dd8a..c224ab0e9b 100644 --- a/indra/llrender/llgl.cpp +++ b/indra/llrender/llgl.cpp @@ -568,6 +568,13 @@ bool LLGLManager::initGL() glGetIntegerv(GL_MAX_SAMPLE_MASK_WORDS, &mMaxSampleMaskWords); } +#if LL_WINDOWS + if (mIsATI) + { //using multisample textures on ATI results in black screen for some reason + mHasTextureMultisample = FALSE; + } +#endif + if (mHasFramebufferObject) { glGetIntegerv(GL_MAX_SAMPLES, &mMaxSamples); -- cgit v1.2.3 From 253642ccff9b08da5e62449ff62b23e986dcb77d Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Thu, 23 Jun 2011 23:06:36 -0500 Subject: SH-1903 Don't use indexed texture rendering when GL version is < 3.1 (fixes bad performance on cards with old drivers) --- indra/llrender/llglslshader.cpp | 10 ++++++++++ indra/llrender/llshadermgr.cpp | 7 ++++++- 2 files changed, 16 insertions(+), 1 deletion(-) (limited to 'indra/llrender') diff --git a/indra/llrender/llglslshader.cpp b/indra/llrender/llglslshader.cpp index 8e99f62de6..ad2c662dfc 100644 --- a/indra/llrender/llglslshader.cpp +++ b/indra/llrender/llglslshader.cpp @@ -109,6 +109,11 @@ BOOL LLGLSLShader::createShader(vector * attributes, // Create program mProgramObject = glCreateProgramObjectARB(); + if (gGLManager.mGLVersion < 3.1f) + { //force indexed texture channels to 1 if GL version is old (performance improvement for drivers with poor branching shader model support) + mFeatures.mIndexedTextureChannels = llmin(mFeatures.mIndexedTextureChannels, 1); + } + //compile new source vector< pair >::iterator fileIter = mShaderFiles.begin(); for ( ; fileIter != mShaderFiles.end(); fileIter++ ) @@ -131,6 +136,11 @@ BOOL LLGLSLShader::createShader(vector * attributes, return FALSE; } + if (gGLManager.mGLVersion < 3.1f) + { //attachShaderFeatures may have set the number of indexed texture channels, so set to 1 again + mFeatures.mIndexedTextureChannels = llmin(mFeatures.mIndexedTextureChannels, 1); + } + // Map attributes and uniforms if (success) { diff --git a/indra/llrender/llshadermgr.cpp b/indra/llrender/llshadermgr.cpp index bdc103b917..3910cd779c 100644 --- a/indra/llrender/llshadermgr.cpp +++ b/indra/llrender/llshadermgr.cpp @@ -524,7 +524,12 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade text[count++] = strdup("{\n"); - if (gGLManager.mGLVersion >= 3.f) + if (texture_index_channels == 1) + { //don't use flow control, that's silly + text[count++] = strdup("return texture2D(tex0, texcoord);\n"); + text[count++] = strdup("}\n"); + } + else if (gGLManager.mGLVersion >= 3.f) { text[count++] = strdup("\tswitch (int(vary_texture_index+0.25))\n"); text[count++] = strdup("\t{\n"); -- cgit v1.2.3 From ad4b559f9fb7c39a090898207c46d4c77d3560bf Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Fri, 24 Jun 2011 15:30:48 -0500 Subject: SH-1903 Fix for silly shader compiler error. --- indra/llrender/llshadermgr.cpp | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) (limited to 'indra/llrender') diff --git a/indra/llrender/llshadermgr.cpp b/indra/llrender/llshadermgr.cpp index 3910cd779c..b4e7aaa9b4 100644 --- a/indra/llrender/llshadermgr.cpp +++ b/indra/llrender/llshadermgr.cpp @@ -542,6 +542,8 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade } text[count++] = strdup("\t}\n"); + text[count++] = strdup("\treturn vec4(0,0,0,0);\n"); + text[count++] = strdup("}\n"); } else { @@ -562,10 +564,10 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade std::string if_str = llformat("if (ti == %d) return texture2D(tex%d, texcoord);\n", i, i); text[count++] = strdup(if_str.c_str()); } - } - text[count++] = strdup("\treturn vec4(0,0,0,0);\n"); - text[count++] = strdup("}\n"); + text[count++] = strdup("\treturn vec4(0,0,0,0);\n"); + text[count++] = strdup("}\n"); + } } //copy file into memory @@ -610,11 +612,6 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade } } - //free memory - for (GLuint i = 0; i < count; i++) - { - free(text[i]); - } if (error == GL_NO_ERROR) { //check for errors @@ -628,6 +625,16 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade //an error occured, print log LL_WARNS("ShaderLoading") << "GLSL Compilation Error: (" << error << ") in " << filename << LL_ENDL; dumpObjectLog(ret); + + std::stringstream ostr; + //dump shader source for debugging + for (GLuint i = 0; i < count; i++) + { + ostr << i << ": " << text[i]; + } + + LL_WARNS("ShaderLoading") << "\n" << ostr.str() << llendl; + ret = 0; } } @@ -638,6 +645,12 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade } stop_glerror(); + //free memory + for (GLuint i = 0; i < count; i++) + { + free(text[i]); + } + //successfully loaded, save results if (ret) { -- cgit v1.2.3 From 5e20cee4b474c20f1a43b46658918be9e05820b0 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Mon, 27 Jun 2011 10:34:21 -0500 Subject: SH-1897 Don't use GLSL 1.20 unless the GL version is >= 2.1f --- indra/llrender/llshadermgr.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'indra/llrender') diff --git a/indra/llrender/llshadermgr.cpp b/indra/llrender/llshadermgr.cpp index b4e7aaa9b4..751b250d96 100644 --- a/indra/llrender/llshadermgr.cpp +++ b/indra/llrender/llshadermgr.cpp @@ -462,7 +462,11 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade GLcharARB* text[1024]; GLuint count = 0; - if (gGLManager.mGLVersion < 3.f) + if (gGLManager.mGLVersion < 2.1f) + { + text[count++] = strdup("#version 110\n"); + } + else if (gGLManager.mGLVersion < 3.f) { //set version to 1.20 text[count++] = strdup("#version 120\n"); -- cgit v1.2.3