Added test setting 'ShyotlUseLegacyTextureBatching' to disable new texture indexing. The new indexing method requires heavy branching in shaders, which some hardware may not perfom well with.

This commit is contained in:
Shyotl
2011-08-16 02:37:18 -05:00
parent 7f0662a1ac
commit 20ef149dcb
5 changed files with 33 additions and 7 deletions

View File

@@ -37,6 +37,7 @@
#include "llshadermgr.h"
#include "llfile.h"
#include "llrender.h"
#include "llcontrol.h"
#if LL_DARWIN
#include "OpenGL/OpenGL.h"
@@ -131,11 +132,12 @@ BOOL LLGLSLShader::createShader(vector<string> * attributes,
// Create program
mProgramObject = glCreateProgramObjectARB();
if (gGLManager.mGLVersion < 3.1f)
static const LLCachedControl<bool> no_texture_indexing("ShyotlUseLegacyTextureBatching",false);
if (gGLManager.mGLVersion < 3.1f || no_texture_indexing)
{ //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++ )
@@ -161,7 +163,7 @@ BOOL LLGLSLShader::createShader(vector<string> * attributes,
return FALSE;
}
if (gGLManager.mGLVersion < 3.1f)
if (gGLManager.mGLVersion < 3.1f || no_texture_indexing)
{ //attachShaderFeatures may have set the number of indexed texture channels, so set to 1 again
mFeatures.mIndexedTextureChannels = llmin(mFeatures.mIndexedTextureChannels, 1);
}

View File

@@ -488,7 +488,28 @@
<key>Value</key>
<integer>0</integer>
</map>
<key>ShyotlUseLegacyRenderPath</key>
<map>
<key>Comment</key>
<string>Use deprecated pre-3.x OpenGL api calls.</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>0</integer>
</map>
<key>ShyotlUseLegacyTextureBatching</key>
<map>
<key>Comment</key>
<string>Disable usage of extra samplers in shaders. Decreases batch sizes, however also reduces branching in shaders drastcially.</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>0</integer>
</map>
<key>ResetFocusOnSelfClick</key>
<map>
<key>Comment</key>
@@ -500,7 +521,6 @@
<key>Value</key>
<integer>1</integer>
</map>
<key>MoyFastMiniMap</key>
<map>
<key>Comment</key>

View File

@@ -648,6 +648,8 @@ void settings_setup_listeners()
//See LL jira VWR-3258 comment section. Implemented by LL in 2.1 -Shyotl
gSavedSettings.getControl("ShyotlRenderUseStreamVBO")->getSignal()->connect(boost::bind(&handleResetVertexBuffersChanged, _2));
gSavedSettings.getControl("ShyotlRenderVBOStrideMode")->getSignal()->connect(boost::bind(&handleResetVertexBuffersChanged, _2));
gSavedSettings.getControl("ShyotlUseLegacyRenderPath")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _2));
gSavedSettings.getControl("ShyotlUseLegacyTextureBatching")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _2));
gSavedSettings.getControl("SianaRenderOmitBlankVBO")->getSignal()->connect(boost::bind(&handleResetVertexBuffersChanged, _2));
gSavedSettings.getControl("RenderUseFBO")->getSignal()->connect(boost::bind(&handleRenderUseFBOChanged, _2));
gSavedSettings.getControl("RenderDeferredNoise")->getSignal()->connect(boost::bind(&handleReleaseGLBufferChanged, _2));

View File

@@ -654,7 +654,8 @@ BOOL LLViewerShaderMgr::loadBasicShaders()
shaders.reserve(13);
S32 ch = gGLManager.mNumTextureImageUnits-1;
if (gGLManager.mGLVersion < 3.1f)
static const LLCachedControl<bool> no_texture_indexing("ShyotlUseLegacyTextureBatching",false);
if (gGLManager.mGLVersion < 3.1f || no_texture_indexing)
{ //force to 1 texture index channel for old drivers
ch = 1;
}

View File

@@ -3657,7 +3657,8 @@ 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)
static const LLCachedControl<bool> no_texture_indexing("ShyotlUseLegacyTextureBatching",false);
if (gGLManager.mGLVersion < 3.1f || no_texture_indexing)
{
texture_index_channels = 1;
}