diff options
author | Dave Parks <davep@lindenlab.com> | 2011-06-23 23:06:36 -0500 |
---|---|---|
committer | Dave Parks <davep@lindenlab.com> | 2011-06-23 23:06:36 -0500 |
commit | 253642ccff9b08da5e62449ff62b23e986dcb77d (patch) | |
tree | 1118351f770d4b07c720527bf02c74e1bfd26c29 /indra | |
parent | 56f8396ff15b7d827f008edd6fe263bae26313f0 (diff) |
SH-1903 Don't use indexed texture rendering when GL version is < 3.1 (fixes bad performance on cards with old drivers)
Diffstat (limited to 'indra')
-rw-r--r-- | indra/llrender/llglslshader.cpp | 10 | ||||
-rw-r--r-- | indra/llrender/llshadermgr.cpp | 7 | ||||
-rw-r--r-- | indra/newview/llvovolume.cpp | 5 |
3 files changed, 21 insertions, 1 deletions
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<string> * 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<string,GLenum> >::iterator fileIter = mShaderFiles.begin(); for ( ; fileIter != mShaderFiles.end(); fileIter++ ) @@ -131,6 +136,11 @@ BOOL LLGLSLShader::createShader(vector<string> * 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"); diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index c5e2c56e4b..e6da8eb89d 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -4495,6 +4495,11 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std:: S32 texture_index_channels = gGLManager.mNumTextureImageUnits-1; //always reserve one for shiny for now just for simplicity + if (gGLManager.mGLVersion < 3.1f) + { + texture_index_channels = 1; + } + if (LLPipeline::sRenderDeferred && distance_sort) { texture_index_channels = gDeferredAlphaProgram.mFeatures.mIndexedTextureChannels; |