summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/llappearance/lltexlayer.cpp115
-rw-r--r--indra/llrender/llcubemap.cpp34
-rw-r--r--indra/llrender/llgl.cpp221
-rw-r--r--indra/llrender/llgl.h1
-rw-r--r--indra/llrender/llglslshader.cpp1
-rw-r--r--indra/llrender/llglslshader.h1
-rw-r--r--indra/llrender/llrender.cpp416
-rw-r--r--indra/llrender/llrender.h5
-rw-r--r--indra/llrender/llrender2dutils.cpp80
-rw-r--r--indra/llrender/llshadermgr.cpp38
-rw-r--r--indra/llrender/llvertexbuffer.cpp353
-rw-r--r--indra/llwindow/llwindowwin32.cpp8
-rw-r--r--indra/newview/lldrawpoolavatar.cpp17
-rw-r--r--indra/newview/lldrawpoolbump.cpp18
-rw-r--r--indra/newview/lldrawpoolsky.cpp12
-rw-r--r--indra/newview/lldrawpoolterrain.cpp21
-rw-r--r--indra/newview/lldrawpooltree.cpp2
-rw-r--r--indra/newview/lldrawpoolwater.cpp19
-rw-r--r--indra/newview/lldrawpoolwlsky.cpp25
-rw-r--r--indra/newview/llfloaterbvhpreview.cpp5
-rw-r--r--indra/newview/llfloaterimagepreview.cpp20
-rw-r--r--indra/newview/llglsandbox.cpp10
-rw-r--r--indra/newview/llhudtext.cpp2
-rw-r--r--indra/newview/lllegacyatmospherics.cpp31
-rw-r--r--indra/newview/llmaniprotate.cpp21
-rw-r--r--indra/newview/llmaniptranslate.cpp7
-rw-r--r--indra/newview/llmodelpreview.cpp23
-rw-r--r--indra/newview/llscenemonitor.cpp9
-rw-r--r--indra/newview/llspatialpartition.cpp14
-rw-r--r--indra/newview/lltoolmorph.cpp5
-rw-r--r--indra/newview/llviewercontrol.cpp2
-rw-r--r--indra/newview/llviewerdisplay.cpp30
-rw-r--r--indra/newview/llviewerjointmesh.cpp4
-rw-r--r--indra/newview/llviewershadermgr.cpp32
-rw-r--r--indra/newview/llviewerwindow.cpp36
-rw-r--r--indra/newview/llvoavatar.cpp20
-rw-r--r--indra/newview/llvosurfacepatch.cpp59
-rw-r--r--indra/newview/llvowater.cpp2
-rw-r--r--indra/newview/pipeline.cpp335
39 files changed, 320 insertions, 1734 deletions
diff --git a/indra/llappearance/lltexlayer.cpp b/indra/llappearance/lltexlayer.cpp
index 26e0ae9086..9af59c7da4 100644
--- a/indra/llappearance/lltexlayer.cpp
+++ b/indra/llappearance/lltexlayer.cpp
@@ -144,17 +144,8 @@ BOOL LLTexLayerSetBuffer::renderTexLayerSet(LLRenderTarget* bound_target)
BOOL success = TRUE;
- bool use_shaders = LLGLSLShader::sNoFixedFunction;
-
- if (use_shaders)
- {
- gAlphaMaskProgram.bind();
- gAlphaMaskProgram.setMinimumAlpha(0.004f);
- }
- else
- {
- gGL.setAlphaRejectSettings(LLRender::CF_GREATER, 0.00f);
- }
+ gAlphaMaskProgram.bind();
+ gAlphaMaskProgram.setMinimumAlpha(0.004f);
LLVertexBuffer::unbind();
@@ -166,10 +157,7 @@ BOOL LLTexLayerSetBuffer::renderTexLayerSet(LLRenderTarget* bound_target)
midRenderTexLayerSet(success);
- if (use_shaders)
- {
- gAlphaMaskProgram.unbind();
- }
+ gAlphaMaskProgram.unbind();
LLVertexBuffer::unbind();
@@ -392,8 +380,6 @@ BOOL LLTexLayerSet::render( S32 x, S32 y, S32 width, S32 height, LLRenderTarget*
}
}
- bool use_shaders = LLGLSLShader::sNoFixedFunction;
-
LLGLSUIDefault gls_ui;
LLGLDepthTest gls_depth(GL_FALSE, GL_FALSE);
gGL.setColorMask(true, true);
@@ -402,20 +388,14 @@ BOOL LLTexLayerSet::render( S32 x, S32 y, S32 width, S32 height, LLRenderTarget*
{
gGL.flush();
LLGLDisable no_alpha(GL_ALPHA_TEST);
- if (use_shaders)
- {
- gAlphaMaskProgram.setMinimumAlpha(0.0f);
- }
+ gAlphaMaskProgram.setMinimumAlpha(0.0f);
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
gGL.color4f( 0.f, 0.f, 0.f, 1.f );
gl_rect_2d_simple( width, height );
gGL.flush();
- if (use_shaders)
- {
- gAlphaMaskProgram.setMinimumAlpha(0.004f);
- }
+ gAlphaMaskProgram.setMinimumAlpha(0.004f);
}
if (mIsVisible)
@@ -442,10 +422,7 @@ BOOL LLTexLayerSet::render( S32 x, S32 y, S32 width, S32 height, LLRenderTarget*
gGL.setSceneBlendType(LLRender::BT_REPLACE);
LLGLDisable no_alpha(GL_ALPHA_TEST);
- if (use_shaders)
- {
- gAlphaMaskProgram.setMinimumAlpha(0.f);
- }
+ gAlphaMaskProgram.setMinimumAlpha(0.f);
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
gGL.color4f( 0.f, 0.f, 0.f, 0.f );
@@ -454,10 +431,7 @@ BOOL LLTexLayerSet::render( S32 x, S32 y, S32 width, S32 height, LLRenderTarget*
gGL.setSceneBlendType(LLRender::BT_ALPHA);
gGL.flush();
- if (use_shaders)
- {
- gAlphaMaskProgram.setMinimumAlpha(0.004f);
- }
+ gAlphaMaskProgram.setMinimumAlpha(0.004f);
}
return success;
@@ -542,8 +516,6 @@ void LLTexLayerSet::renderAlphaMaskTextures(S32 x, S32 y, S32 width, S32 height,
LL_PROFILE_ZONE_SCOPED;
const LLTexLayerSetInfo *info = getInfo();
- bool use_shaders = LLGLSLShader::sNoFixedFunction;
-
gGL.setColorMask(false, true);
gGL.setSceneBlendType(LLRender::BT_REPLACE);
@@ -568,20 +540,14 @@ void LLTexLayerSet::renderAlphaMaskTextures(S32 x, S32 y, S32 width, S32 height,
// Set the alpha channel to one (clean up after previous blending)
gGL.flush();
LLGLDisable no_alpha(GL_ALPHA_TEST);
- if (use_shaders)
- {
- gAlphaMaskProgram.setMinimumAlpha(0.f);
- }
+ gAlphaMaskProgram.setMinimumAlpha(0.f);
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
gGL.color4f( 0.f, 0.f, 0.f, 1.f );
gl_rect_2d_simple( width, height );
gGL.flush();
- if (use_shaders)
- {
- gAlphaMaskProgram.setMinimumAlpha(0.004f);
- }
+ gAlphaMaskProgram.setMinimumAlpha(0.004f);
}
// (Optional) Mask out part of the baked texture with alpha masks
@@ -1128,13 +1094,6 @@ BOOL LLTexLayer::render(S32 x, S32 y, S32 width, S32 height, LLRenderTarget* bou
// *TODO: Is this correct?
//gPipeline.disableLights();
stop_glerror();
- if (!LLGLSLShader::sNoFixedFunction)
- {
- glDisable(GL_LIGHTING);
- }
- stop_glerror();
-
- bool use_shaders = LLGLSLShader::sNoFixedFunction;
LLColor4 net_color;
BOOL color_specified = findNetColor(&net_color);
@@ -1221,10 +1180,7 @@ BOOL LLTexLayer::render(S32 x, S32 y, S32 width, S32 height, LLRenderTarget* bou
LLGLDisable alpha_test(no_alpha_test ? GL_ALPHA_TEST : 0);
if (no_alpha_test)
{
- if (use_shaders)
- {
- gAlphaMaskProgram.setMinimumAlpha(0.f);
- }
+ gAlphaMaskProgram.setMinimumAlpha(0.f);
}
LLTexUnit::eTextureAddressMode old_mode = tex->getAddressMode();
@@ -1238,10 +1194,7 @@ BOOL LLTexLayer::render(S32 x, S32 y, S32 width, S32 height, LLRenderTarget* bou
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
if (no_alpha_test)
{
- if (use_shaders)
- {
- gAlphaMaskProgram.setMinimumAlpha(0.004f);
- }
+ gAlphaMaskProgram.setMinimumAlpha(0.004f);
}
}
}
@@ -1275,18 +1228,12 @@ BOOL LLTexLayer::render(S32 x, S32 y, S32 width, S32 height, LLRenderTarget* bou
color_specified )
{
LLGLDisable no_alpha(GL_ALPHA_TEST);
- if (use_shaders)
- {
- gAlphaMaskProgram.setMinimumAlpha(0.000f);
- }
+ gAlphaMaskProgram.setMinimumAlpha(0.000f);
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
gGL.color4fv( net_color.mV );
gl_rect_2d_simple( width, height );
- if (use_shaders)
- {
- gAlphaMaskProgram.setMinimumAlpha(0.004f);
- }
+ gAlphaMaskProgram.setMinimumAlpha(0.004f);
}
if( alpha_mask_specified || getInfo()->mWriteAllChannels )
@@ -1374,25 +1321,17 @@ BOOL LLTexLayer::blendAlphaTexture(S32 x, S32 y, S32 width, S32 height)
gGL.flush();
- bool use_shaders = LLGLSLShader::sNoFixedFunction;
-
if( !getInfo()->mStaticImageFileName.empty() )
{
LLGLTexture* tex = LLTexLayerStaticImageList::getInstance()->getTexture( getInfo()->mStaticImageFileName, getInfo()->mStaticImageIsMask );
if( tex )
{
LLGLSNoAlphaTest gls_no_alpha_test;
- if (use_shaders)
- {
- gAlphaMaskProgram.setMinimumAlpha(0.f);
- }
+ gAlphaMaskProgram.setMinimumAlpha(0.f);
gGL.getTexUnit(0)->bind(tex, TRUE);
gl_rect_2d_simple_tex( width, height );
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
- if (use_shaders)
- {
- gAlphaMaskProgram.setMinimumAlpha(0.004f);
- }
+ gAlphaMaskProgram.setMinimumAlpha(0.004f);
}
else
{
@@ -1407,18 +1346,11 @@ BOOL LLTexLayer::blendAlphaTexture(S32 x, S32 y, S32 width, S32 height)
if (tex)
{
LLGLSNoAlphaTest gls_no_alpha_test;
- if (use_shaders)
- {
- gAlphaMaskProgram.setMinimumAlpha(0.f);
- }
+ gAlphaMaskProgram.setMinimumAlpha(0.f);
gGL.getTexUnit(0)->bind(tex);
gl_rect_2d_simple_tex( width, height );
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
- success = TRUE;
- if (use_shaders)
- {
- gAlphaMaskProgram.setMinimumAlpha(0.004f);
- }
+ gAlphaMaskProgram.setMinimumAlpha(0.004f);
}
}
}
@@ -1443,13 +1375,7 @@ void LLTexLayer::renderMorphMasks(S32 x, S32 y, S32 width, S32 height, const LLC
llassert( !mParamAlphaList.empty() );
- bool use_shaders = LLGLSLShader::sNoFixedFunction;
-
- if (use_shaders)
- {
- gAlphaMaskProgram.setMinimumAlpha(0.f);
- }
-
+ gAlphaMaskProgram.setMinimumAlpha(0.f);
gGL.setColorMask(false, true);
LLTexLayerParamAlpha* first_param = *mParamAlphaList.begin();
@@ -1534,10 +1460,7 @@ void LLTexLayer::renderMorphMasks(S32 x, S32 y, S32 width, S32 height, const LLC
gl_rect_2d_simple( width, height );
}
- if (use_shaders)
- {
- gAlphaMaskProgram.setMinimumAlpha(0.004f);
- }
+ gAlphaMaskProgram.setMinimumAlpha(0.004f);
LLGLSUIDefault gls_ui;
diff --git a/indra/llrender/llcubemap.cpp b/indra/llrender/llcubemap.cpp
index d7f7b2f58e..d2faa5f3ae 100644
--- a/indra/llrender/llcubemap.cpp
+++ b/indra/llrender/llcubemap.cpp
@@ -195,26 +195,6 @@ void LLCubeMap::enableTexture(S32 stage)
void LLCubeMap::enableTextureCoords(S32 stage)
{
mTextureCoordStage = stage;
- if (!LLGLSLShader::sNoFixedFunction && gGLManager.mHasCubeMap && stage >= 0 && LLCubeMap::sUseCubeMaps)
- {
- if (stage > 0)
- {
- gGL.getTexUnit(stage)->activate();
- }
-
- glEnable(GL_TEXTURE_GEN_R);
- glEnable(GL_TEXTURE_GEN_S);
- glEnable(GL_TEXTURE_GEN_T);
-
- glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP);
- glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP);
- glTexGeni(GL_R, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP);
-
- if (stage > 0)
- {
- gGL.getTexUnit(0)->activate();
- }
- }
}
void LLCubeMap::disable(void)
@@ -237,20 +217,6 @@ void LLCubeMap::disableTexture(void)
void LLCubeMap::disableTextureCoords(void)
{
- if (!LLGLSLShader::sNoFixedFunction && gGLManager.mHasCubeMap && mTextureCoordStage >= 0 && LLCubeMap::sUseCubeMaps)
- {
- if (mTextureCoordStage > 0)
- {
- gGL.getTexUnit(mTextureCoordStage)->activate();
- }
- glDisable(GL_TEXTURE_GEN_S);
- glDisable(GL_TEXTURE_GEN_T);
- glDisable(GL_TEXTURE_GEN_R);
- if (mTextureCoordStage > 0)
- {
- gGL.getTexUnit(0)->activate();
- }
- }
}
void LLCubeMap::setMatrix(S32 stage)
diff --git a/indra/llrender/llgl.cpp b/indra/llrender/llgl.cpp
index b49b14615f..58183adfce 100644
--- a/indra/llrender/llgl.cpp
+++ b/indra/llrender/llgl.cpp
@@ -1936,207 +1936,30 @@ void LLGLState::checkTextureChannels(const std::string& msg)
#endif
}
-void LLGLState::checkClientArrays(const std::string& msg, U32 data_mask)
-{
- if (!gDebugGL || LLGLSLShader::sNoFixedFunction)
- {
- return;
- }
-
- stop_glerror();
- BOOL error = FALSE;
-
- GLint active_texture;
- glGetIntegerv(GL_CLIENT_ACTIVE_TEXTURE_ARB, &active_texture);
-
- if (active_texture != GL_TEXTURE0_ARB)
- {
- LL_WARNS() << "Client active texture corrupted: " << active_texture << LL_ENDL;
- if (gDebugSession)
- {
- gFailLog << "Client active texture corrupted: " << active_texture << std::endl;
- }
- error = TRUE;
- }
-
- /*glGetIntegerv(GL_ACTIVE_TEXTURE_ARB, &active_texture);
- if (active_texture != GL_TEXTURE0_ARB)
- {
- LL_WARNS() << "Active texture corrupted: " << active_texture << LL_ENDL;
- if (gDebugSession)
- {
- gFailLog << "Active texture corrupted: " << active_texture << std::endl;
- }
- error = TRUE;
- }*/
-
- static const char* label[] =
- {
- "GL_VERTEX_ARRAY",
- "GL_NORMAL_ARRAY",
- "GL_COLOR_ARRAY",
- "GL_TEXTURE_COORD_ARRAY"
- };
-
- static GLint value[] =
- {
- GL_VERTEX_ARRAY,
- GL_NORMAL_ARRAY,
- GL_COLOR_ARRAY,
- GL_TEXTURE_COORD_ARRAY
- };
-
- static const U32 mask[] =
- { //copied from llvertexbuffer.h
- 0x0001, //MAP_VERTEX,
- 0x0002, //MAP_NORMAL,
- 0x0010, //MAP_COLOR,
- 0x0004, //MAP_TEXCOORD
- };
-
-
- for (S32 j = 1; j < 4; j++)
- {
- if (glIsEnabled(value[j]))
- {
- if (!(mask[j] & data_mask))
- {
- error = TRUE;
- LL_WARNS("RenderState") << "GL still has " << label[j] << " enabled." << LL_ENDL;
- if (gDebugSession)
- {
- gFailLog << "GL still has " << label[j] << " enabled." << std::endl;
- }
- }
- }
- else
- {
- if (mask[j] & data_mask)
- {
- error = TRUE;
- LL_WARNS("RenderState") << "GL does not have " << label[j] << " enabled." << LL_ENDL;
- if (gDebugSession)
- {
- gFailLog << "GL does not have " << label[j] << " enabled." << std::endl;
- }
- }
- }
- }
-
- glClientActiveTextureARB(GL_TEXTURE1_ARB);
- gGL.getTexUnit(1)->activate();
- if (glIsEnabled(GL_TEXTURE_COORD_ARRAY))
- {
- if (!(data_mask & 0x0008))
- {
- error = TRUE;
- LL_WARNS("RenderState") << "GL still has GL_TEXTURE_COORD_ARRAY enabled on channel 1." << LL_ENDL;
- if (gDebugSession)
- {
- gFailLog << "GL still has GL_TEXTURE_COORD_ARRAY enabled on channel 1." << std::endl;
- }
- }
- }
- else
- {
- if (data_mask & 0x0008)
- {
- error = TRUE;
- LL_WARNS("RenderState") << "GL does not have GL_TEXTURE_COORD_ARRAY enabled on channel 1." << LL_ENDL;
- if (gDebugSession)
- {
- gFailLog << "GL does not have GL_TEXTURE_COORD_ARRAY enabled on channel 1." << std::endl;
- }
- }
- }
-
- /*if (glIsEnabled(GL_TEXTURE_2D))
- {
- if (!(data_mask & 0x0008))
- {
- error = TRUE;
- LL_WARNS("RenderState") << "GL still has GL_TEXTURE_2D enabled on channel 1." << LL_ENDL;
- if (gDebugSession)
- {
- gFailLog << "GL still has GL_TEXTURE_2D enabled on channel 1." << std::endl;
- }
- }
- }
- else
- {
- if (data_mask & 0x0008)
- {
- error = TRUE;
- LL_WARNS("RenderState") << "GL does not have GL_TEXTURE_2D enabled on channel 1." << LL_ENDL;
- if (gDebugSession)
- {
- gFailLog << "GL does not have GL_TEXTURE_2D enabled on channel 1." << std::endl;
- }
- }
- }*/
-
- glClientActiveTextureARB(GL_TEXTURE0_ARB);
- gGL.getTexUnit(0)->activate();
-
- if (LLGLSLShader::sNoFixedFunction)
- { //make sure vertex attribs are all disabled
- GLint count;
- glGetIntegerv(GL_MAX_VERTEX_ATTRIBS_ARB, &count);
- for (GLint i = 0; i < count; i++)
- {
- GLint enabled;
- glGetVertexAttribivARB((GLuint) i, GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB, &enabled);
- if (enabled)
- {
- error = TRUE;
- LL_WARNS("RenderState") << "GL still has vertex attrib array " << i << " enabled." << LL_ENDL;
- if (gDebugSession)
- {
- gFailLog << "GL still has vertex attrib array " << i << " enabled." << std::endl;
- }
- }
- }
- }
-
- if (error)
- {
- if (gDebugSession)
- {
- ll_fail("LLGLState::checkClientArrays failed.");
- }
- else
- {
- LL_GL_ERRS << "GL client array corruption detected. " << msg << LL_ENDL;
- }
- }
-}
-
///////////////////////////////////////////////////////////////////////
LLGLState::LLGLState(LLGLenum state, S32 enabled) :
mState(state), mWasEnabled(FALSE), mIsEnabled(FALSE)
{
LL_PROFILE_ZONE_SCOPED;
- if (LLGLSLShader::sNoFixedFunction)
- { //always ignore state that's deprecated post GL 3.0
- switch (state)
- {
- case GL_ALPHA_TEST:
- case GL_NORMALIZE:
- case GL_TEXTURE_GEN_R:
- case GL_TEXTURE_GEN_S:
- case GL_TEXTURE_GEN_T:
- case GL_TEXTURE_GEN_Q:
- case GL_LIGHTING:
- case GL_COLOR_MATERIAL:
- case GL_FOG:
- case GL_LINE_STIPPLE:
- case GL_POLYGON_STIPPLE:
- mState = 0;
- break;
- }
+ switch (state)
+ {
+ case GL_ALPHA_TEST:
+ case GL_NORMALIZE:
+ case GL_TEXTURE_GEN_R:
+ case GL_TEXTURE_GEN_S:
+ case GL_TEXTURE_GEN_T:
+ case GL_TEXTURE_GEN_Q:
+ case GL_LIGHTING:
+ case GL_COLOR_MATERIAL:
+ case GL_FOG:
+ case GL_LINE_STIPPLE:
+ case GL_POLYGON_STIPPLE:
+ mState = 0;
+ break;
}
+
stop_glerror();
if (mState)
{
@@ -2688,22 +2511,10 @@ LLGLSPipelineSkyBox::LLGLSPipelineSkyBox()
, mCullFace(GL_CULL_FACE)
, mSquashClip()
{
- if (!LLGLSLShader::sNoFixedFunction)
- {
- glDisable(GL_LIGHTING);
- glDisable(GL_FOG);
- glDisable(GL_CLIP_PLANE0);
- }
}
LLGLSPipelineSkyBox::~LLGLSPipelineSkyBox()
{
- if (!LLGLSLShader::sNoFixedFunction)
- {
- glEnable(GL_LIGHTING);
- glEnable(GL_FOG);
- glEnable(GL_CLIP_PLANE0);
- }
}
LLGLSPipelineDepthTestSkyBox::LLGLSPipelineDepthTestSkyBox(bool depth_test, bool depth_write)
diff --git a/indra/llrender/llgl.h b/indra/llrender/llgl.h
index 6e1f5e6deb..386d12d70a 100644
--- a/indra/llrender/llgl.h
+++ b/indra/llrender/llgl.h
@@ -266,7 +266,6 @@ public:
static void dumpStates();
static void checkStates(const std::string& msg = "");
static void checkTextureChannels(const std::string& msg = "");
- static void checkClientArrays(const std::string& msg = "", U32 data_mask = 0);
protected:
static boost::unordered_map<LLGLenum, LLGLboolean> sStateMap;
diff --git a/indra/llrender/llglslshader.cpp b/indra/llrender/llglslshader.cpp
index 2f1ce0eec9..220e88386a 100644
--- a/indra/llrender/llglslshader.cpp
+++ b/indra/llrender/llglslshader.cpp
@@ -50,7 +50,6 @@ using std::string;
GLhandleARB LLGLSLShader::sCurBoundShader = 0;
LLGLSLShader* LLGLSLShader::sCurBoundShaderPtr = NULL;
S32 LLGLSLShader::sIndexedTextureChannels = 0;
-bool LLGLSLShader::sNoFixedFunction = false;
bool LLGLSLShader::sProfileEnabled = false;
std::set<LLGLSLShader*> LLGLSLShader::sInstances;
U64 LLGLSLShader::sTotalTimeElapsed = 0;
diff --git a/indra/llrender/llglslshader.h b/indra/llrender/llglslshader.h
index 6fdb789087..85e83dbcb9 100644
--- a/indra/llrender/llglslshader.h
+++ b/indra/llrender/llglslshader.h
@@ -148,7 +148,6 @@ public:
static GLhandleARB sCurBoundShader;
static LLGLSLShader* sCurBoundShaderPtr;
static S32 sIndexedTextureChannels;
- static bool sNoFixedFunction;
static void initProfile();
static void finishProfile(bool emit_report = true);
diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp
index 0c180ed50d..899c61ccb7 100644
--- a/indra/llrender/llrender.cpp
+++ b/indra/llrender/llrender.cpp
@@ -128,29 +128,12 @@ void LLTexUnit::refreshState(void)
glActiveTextureARB(GL_TEXTURE0_ARB + mIndex);
- //
- // Per apple spec, don't call glEnable/glDisable when index exceeds max texture units
- // http://www.mailinglistarchive.com/html/mac-opengl@lists.apple.com/2008-07/msg00653.html
- //
- bool enableDisable = !LLGLSLShader::sNoFixedFunction &&
- (mIndex < gGLManager.mNumTextureUnits) && mCurrTexType != LLTexUnit::TT_MULTISAMPLE_TEXTURE;
-
if (mCurrTexType != TT_NONE)
{
- if (enableDisable)
- {
- glEnable(sGLTextureType[mCurrTexType]);
- }
-
glBindTexture(sGLTextureType[mCurrTexType], mCurrTexture);
}
else
{
- if (enableDisable)
- {
- glDisable(GL_TEXTURE_2D);
- }
-
glBindTexture(GL_TEXTURE_2D, 0);
}
@@ -158,11 +141,6 @@ void LLTexUnit::refreshState(void)
{
setTextureBlendType(mCurrBlendType);
}
- else
- {
- setTextureCombiner(mCurrColorOp, mCurrColorSrc1, mCurrColorSrc2, false);
- setTextureCombiner(mCurrAlphaOp, mCurrAlphaSrc1, mCurrAlphaSrc2, true);
- }
setTextureColorSpace(mTexColorSpace);
}
@@ -196,14 +174,6 @@ void LLTexUnit::enable(eTextureType type)
mCurrTexType = type;
gGL.flush();
- if (!LLGLSLShader::sNoFixedFunction &&
- type != LLTexUnit::TT_MULTISAMPLE_TEXTURE &&
- mIndex < gGLManager.mNumTextureUnits)
- {
- stop_glerror();
- glEnable(sGLTextureType[type]);
- stop_glerror();
- }
}
}
@@ -216,13 +186,6 @@ void LLTexUnit::disable(void)
activate();
unbind(mCurrTexType);
gGL.flush();
- if (!LLGLSLShader::sNoFixedFunction &&
- mCurrTexType != LLTexUnit::TT_MULTISAMPLE_TEXTURE &&
- mIndex < gGLManager.mNumTextureUnits)
- {
- glDisable(sGLTextureType[mCurrTexType]);
- }
-
setTextureColorSpace(TCS_LINEAR);
mCurrTexType = TT_NONE;
@@ -465,7 +428,7 @@ void LLTexUnit::unbind(eTextureType type)
// Always make sure our texture color space is reset to linear. SRGB sampling should be opt-in in the vast majority of cases. Also prevents color space "popping".
mTexColorSpace = TCS_LINEAR;
- if (LLGLSLShader::sNoFixedFunction && type == LLTexUnit::TT_TEXTURE)
+ if (type == LLTexUnit::TT_TEXTURE)
{
glBindTexture(sGLTextureType[type], sWhiteTexture);
}
@@ -579,51 +542,6 @@ void LLTexUnit::setTextureFilteringOption(LLTexUnit::eTextureFilterOptions optio
void LLTexUnit::setTextureBlendType(eTextureBlendType type)
{
- if (LLGLSLShader::sNoFixedFunction)
- { //texture blend type means nothing when using shaders
- return;
- }
-
- if (mIndex < 0) return;
-
- // Do nothing if it's already correctly set.
- if (mCurrBlendType == type && !gGL.mDirty)
- {
- return;
- }
-
- gGL.flush();
-
- activate();
- mCurrBlendType = type;
- S32 scale_amount = 1;
- switch (type)
- {
- case TB_REPLACE:
- glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
- break;
- case TB_ADD:
- glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_ADD);
- break;
- case TB_MULT:
- glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
- break;
- case TB_MULT_X2:
- glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
- scale_amount = 2;
- break;
- case TB_ALPHA_BLEND:
- glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL);
- break;
- case TB_COMBINE:
- glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB);
- break;
- default:
- LL_ERRS() << "Unknown Texture Blend Type: " << type << LL_ENDL;
- break;
- }
- setColorScale(scale_amount);
- setAlphaScale(1);
}
GLint LLTexUnit::getTextureSource(eTextureBlendSrc src)
@@ -702,159 +620,6 @@ GLint LLTexUnit::getTextureSourceType(eTextureBlendSrc src, bool isAlpha)
}
}
-void LLTexUnit::setTextureCombiner(eTextureBlendOp op, eTextureBlendSrc src1, eTextureBlendSrc src2, bool isAlpha)
-{
- if (LLGLSLShader::sNoFixedFunction)
- { //register combiners do nothing when not using fixed function
- return;
- }
-
- if (mIndex < 0) return;
-
- activate();
- if (mCurrBlendType != TB_COMBINE || gGL.mDirty)
- {
- mCurrBlendType = TB_COMBINE;
- gGL.flush();
- glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_ARB);
- }
-
- // We want an early out, because this function does a LOT of stuff.
- if ( ( (isAlpha && (mCurrAlphaOp == op) && (mCurrAlphaSrc1 == src1) && (mCurrAlphaSrc2 == src2))
- || (!isAlpha && (mCurrColorOp == op) && (mCurrColorSrc1 == src1) && (mCurrColorSrc2 == src2)) ) && !gGL.mDirty)
- {
- return;
- }
-
- gGL.flush();
-
- // Get the gl source enums according to the eTextureBlendSrc sources passed in
- GLint source1 = getTextureSource(src1);
- GLint source2 = getTextureSource(src2);
- // Get the gl operand enums according to the eTextureBlendSrc sources passed in
- GLint operand1 = getTextureSourceType(src1, isAlpha);
- GLint operand2 = getTextureSourceType(src2, isAlpha);
- // Default the scale amount to 1
- S32 scale_amount = 1;
- GLenum comb_enum, src0_enum, src1_enum, src2_enum, operand0_enum, operand1_enum, operand2_enum;
-
- if (isAlpha)
- {
- // Set enums to ALPHA ones
- comb_enum = GL_COMBINE_ALPHA_ARB;
- src0_enum = GL_SOURCE0_ALPHA_ARB;
- src1_enum = GL_SOURCE1_ALPHA_ARB;
- src2_enum = GL_SOURCE2_ALPHA_ARB;
- operand0_enum = GL_OPERAND0_ALPHA_ARB;
- operand1_enum = GL_OPERAND1_ALPHA_ARB;
- operand2_enum = GL_OPERAND2_ALPHA_ARB;
-
- // cache current combiner
- mCurrAlphaOp = op;
- mCurrAlphaSrc1 = src1;
- mCurrAlphaSrc2 = src2;
- }
- else
- {
- // Set enums to RGB ones
- comb_enum = GL_COMBINE_RGB_ARB;
- src0_enum = GL_SOURCE0_RGB_ARB;
- src1_enum = GL_SOURCE1_RGB_ARB;
- src2_enum = GL_SOURCE2_RGB_ARB;
- operand0_enum = GL_OPERAND0_RGB_ARB;
- operand1_enum = GL_OPERAND1_RGB_ARB;
- operand2_enum = GL_OPERAND2_RGB_ARB;
-
- // cache current combiner
- mCurrColorOp = op;
- mCurrColorSrc1 = src1;
- mCurrColorSrc2 = src2;
- }
-
- switch(op)
- {
- case TBO_REPLACE:
- // Slightly special syntax (no second sources), just set all and return.
- glTexEnvi(GL_TEXTURE_ENV, comb_enum, GL_REPLACE);
- glTexEnvi(GL_TEXTURE_ENV, src0_enum, source1);
- glTexEnvi(GL_TEXTURE_ENV, operand0_enum, operand1);
- (isAlpha) ? setAlphaScale(1) : setColorScale(1);
- return;
-
- case TBO_MULT:
- glTexEnvi(GL_TEXTURE_ENV, comb_enum, GL_MODULATE);
- break;
-
- case TBO_MULT_X2:
- glTexEnvi(GL_TEXTURE_ENV, comb_enum, GL_MODULATE);
- scale_amount = 2;
- break;
-
- case TBO_MULT_X4:
- glTexEnvi(GL_TEXTURE_ENV, comb_enum, GL_MODULATE);
- scale_amount = 4;
- break;
-
- case TBO_ADD:
- glTexEnvi(GL_TEXTURE_ENV, comb_enum, GL_ADD);
- break;
-
- case TBO_ADD_SIGNED:
- glTexEnvi(GL_TEXTURE_ENV, comb_enum, GL_ADD_SIGNED_ARB);
- break;
-
- case TBO_SUBTRACT:
- glTexEnvi(GL_TEXTURE_ENV, comb_enum, GL_SUBTRACT_ARB);
- break;
-
- case TBO_LERP_VERT_ALPHA:
- glTexEnvi(GL_TEXTURE_ENV, comb_enum, GL_INTERPOLATE);
- glTexEnvi(GL_TEXTURE_ENV, src2_enum, GL_PRIMARY_COLOR_ARB);
- glTexEnvi(GL_TEXTURE_ENV, operand2_enum, GL_SRC_ALPHA);
- break;
-
- case TBO_LERP_TEX_ALPHA:
- glTexEnvi(GL_TEXTURE_ENV, comb_enum, GL_INTERPOLATE);
- glTexEnvi(GL_TEXTURE_ENV, src2_enum, GL_TEXTURE);
- glTexEnvi(GL_TEXTURE_ENV, operand2_enum, GL_SRC_ALPHA);
- break;
-
- case TBO_LERP_PREV_ALPHA:
- glTexEnvi(GL_TEXTURE_ENV, comb_enum, GL_INTERPOLATE);
- glTexEnvi(GL_TEXTURE_ENV, src2_enum, GL_PREVIOUS_ARB);
- glTexEnvi(GL_TEXTURE_ENV, operand2_enum, GL_SRC_ALPHA);
- break;
-
- case TBO_LERP_CONST_ALPHA:
- glTexEnvi(GL_TEXTURE_ENV, comb_enum, GL_INTERPOLATE);
- glTexEnvi(GL_TEXTURE_ENV, src2_enum, GL_CONSTANT_ARB);
- glTexEnvi(GL_TEXTURE_ENV, operand2_enum, GL_SRC_ALPHA);
- break;
-
- case TBO_LERP_VERT_COLOR:
- glTexEnvi(GL_TEXTURE_ENV, comb_enum, GL_INTERPOLATE);
- glTexEnvi(GL_TEXTURE_ENV, src2_enum, GL_PRIMARY_COLOR_ARB);
- glTexEnvi(GL_TEXTURE_ENV, operand2_enum, (isAlpha) ? GL_SRC_ALPHA : GL_SRC_COLOR);
- break;
-
- default:
- LL_WARNS() << "Unknown eTextureBlendOp: " << op << ". Setting op to replace." << LL_ENDL;
- // Slightly special syntax (no second sources), just set all and return.
- glTexEnvi(GL_TEXTURE_ENV, comb_enum, GL_REPLACE);
- glTexEnvi(GL_TEXTURE_ENV, src0_enum, source1);
- glTexEnvi(GL_TEXTURE_ENV, operand0_enum, operand1);
- (isAlpha) ? setAlphaScale(1) : setColorScale(1);
- return;
- }
-
- // Set sources, operands, and scale accordingly
- glTexEnvi(GL_TEXTURE_ENV, src0_enum, source1);
- glTexEnvi(GL_TEXTURE_ENV, operand0_enum, operand1);
- glTexEnvi(GL_TEXTURE_ENV, src1_enum, source2);
- glTexEnvi(GL_TEXTURE_ENV, operand1_enum, operand2);
- (isAlpha) ? setAlphaScale(scale_amount) : setColorScale(scale_amount);
-}
-
void LLTexUnit::setColorScale(S32 scale)
{
if (mCurrColorScale != scale || gGL.mDirty)
@@ -943,26 +708,12 @@ LLLightState::LLLightState(S32 index)
void LLLightState::enable()
{
- if (!mEnabled)
- {
- if (!LLGLSLShader::sNoFixedFunction)
- {
- glEnable(GL_LIGHT0+mIndex);
- }
- mEnabled = true;
- }
+ mEnabled = true;
}
void LLLightState::disable()
{
- if (mEnabled)
- {
- if (!LLGLSLShader::sNoFixedFunction)
- {
- glDisable(GL_LIGHT0+mIndex);
- }
- mEnabled = false;
- }
+ mEnabled = false;
}
void LLLightState::setDiffuse(const LLColor4& diffuse)
@@ -971,10 +722,6 @@ void LLLightState::setDiffuse(const LLColor4& diffuse)
{
++gGL.mLightHash;
mDiffuse = diffuse;
- if (!LLGLSLShader::sNoFixedFunction)
- {
- glLightfv(GL_LIGHT0+mIndex, GL_DIFFUSE, mDiffuse.mV);
- }
}
}
@@ -1002,10 +749,6 @@ void LLLightState::setAmbient(const LLColor4& ambient)
{
++gGL.mLightHash;
mAmbient = ambient;
- if (!LLGLSLShader::sNoFixedFunction)
- {
- glLightfv(GL_LIGHT0+mIndex, GL_AMBIENT, mAmbient.mV);
- }
}
}
@@ -1015,10 +758,6 @@ void LLLightState::setSpecular(const LLColor4& specular)
{
++gGL.mLightHash;
mSpecular = specular;
- if (!LLGLSLShader::sNoFixedFunction)
- {
- glLightfv(GL_LIGHT0+mIndex, GL_SPECULAR, mSpecular.mV);
- }
}
}
@@ -1027,20 +766,11 @@ void LLLightState::setPosition(const LLVector4& position)
//always set position because modelview matrix may have changed
++gGL.mLightHash;
mPosition = position;
- if (!LLGLSLShader::sNoFixedFunction)
- {
- glLightfv(GL_LIGHT0+mIndex, GL_POSITION, mPosition.mV);
- }
- else
- { //transform position by current modelview matrix
- glh::vec4f pos(position.mV);
-
- const glh::matrix4f& mat = gGL.getModelviewMatrix();
- mat.mult_matrix_vec(pos);
-
- mPosition.set(pos.v);
- }
-
+ //transform position by current modelview matrix
+ glh::vec4f pos(position.mV);
+ const glh::matrix4f& mat = gGL.getModelviewMatrix();
+ mat.mult_matrix_vec(pos);
+ mPosition.set(pos.v);
}
void LLLightState::setConstantAttenuation(const F32& atten)
@@ -1049,10 +779,6 @@ void LLLightState::setConstantAttenuation(const F32& atten)
{
mConstantAtten = atten;
++gGL.mLightHash;
- if (!LLGLSLShader::sNoFixedFunction)
- {
- glLightf(GL_LIGHT0+mIndex, GL_CONSTANT_ATTENUATION, atten);
- }
}
}
@@ -1062,10 +788,6 @@ void LLLightState::setLinearAttenuation(const F32& atten)
{
++gGL.mLightHash;
mLinearAtten = atten;
- if (!LLGLSLShader::sNoFixedFunction)
- {
- glLightf(GL_LIGHT0+mIndex, GL_LINEAR_ATTENUATION, atten);
- }
}
}
@@ -1075,10 +797,6 @@ void LLLightState::setQuadraticAttenuation(const F32& atten)
{
++gGL.mLightHash;
mQuadraticAtten = atten;
- if (!LLGLSLShader::sNoFixedFunction)
- {
- glLightf(GL_LIGHT0+mIndex, GL_QUADRATIC_ATTENUATION, atten);
- }
}
}
@@ -1088,10 +806,6 @@ void LLLightState::setSpotExponent(const F32& exponent)
{
++gGL.mLightHash;
mSpotExponent = exponent;
- if (!LLGLSLShader::sNoFixedFunction)
- {
- glLightf(GL_LIGHT0+mIndex, GL_SPOT_EXPONENT, exponent);
- }
}
}
@@ -1101,10 +815,6 @@ void LLLightState::setSpotCutoff(const F32& cutoff)
{
++gGL.mLightHash;
mSpotCutoff = cutoff;
- if (!LLGLSLShader::sNoFixedFunction)
- {
- glLightf(GL_LIGHT0+mIndex, GL_SPOT_CUTOFF, cutoff);
- }
}
}
@@ -1113,19 +823,12 @@ void LLLightState::setSpotDirection(const LLVector3& direction)
//always set direction because modelview matrix may have changed
++gGL.mLightHash;
mSpotDirection = direction;
- if (!LLGLSLShader::sNoFixedFunction)
- {
- glLightfv(GL_LIGHT0+mIndex, GL_SPOT_DIRECTION, direction.mV);
- }
- else
- { //transform direction by current modelview matrix
- glh::vec3f dir(direction.mV);
-
- const glh::matrix4f& mat = gGL.getModelviewMatrix();
- mat.mult_matrix_dir(dir);
+ //transform direction by current modelview matrix
+ glh::vec3f dir(direction.mV);
+ const glh::matrix4f& mat = gGL.getModelviewMatrix();
+ mat.mult_matrix_dir(dir);
- mSpotDirection.set(dir.v);
- }
+ mSpotDirection.set(dir.v);
}
LLRender::LLRender()
@@ -1420,39 +1123,6 @@ void LLRender::syncMatrices()
syncLightState();
}
}
- else if (!LLGLSLShader::sNoFixedFunction)
- {
- static const GLenum mode[] =
- {
- GL_MODELVIEW,
- GL_PROJECTION,
- GL_TEXTURE,
- GL_TEXTURE,
- GL_TEXTURE,
- GL_TEXTURE,
- };
-
- for (U32 i = 0; i < MM_TEXTURE0; ++i)
- {
- if (mMatHash[i] != mCurMatHash[i])
- {
- glMatrixMode(mode[i]);
- glLoadMatrixf(mMatrix[i][mMatIdx[i]].m);
- mCurMatHash[i] = mMatHash[i];
- }
- }
-
- for (U32 i = MM_TEXTURE0; i < NUM_MATRIX_MODES; ++i)
- {
- if (mMatHash[i] != mCurMatHash[i])
- {
- gGL.getTexUnit(i-MM_TEXTURE0)->activate();
- glMatrixMode(mode[i]);
- glLoadMatrixf(mMatrix[i][mMatIdx[i]].m);
- mCurMatHash[i] = mMatHash[i];
- }
- }
- }
}
void LLRender::translatef(const GLfloat& x, const GLfloat& y, const GLfloat& z)
@@ -1771,50 +1441,6 @@ void LLRender::setSceneBlendType(eBlendType type)
void LLRender::setAlphaRejectSettings(eCompareFunc func, F32 value)
{
flush();
-
- if (LLGLSLShader::sNoFixedFunction)
- { //glAlphaFunc is deprecated in OpenGL 3.3
- return;
- }
-
- if (mCurrAlphaFunc != func ||
- mCurrAlphaFuncVal != value)
- {
- mCurrAlphaFunc = func;
- mCurrAlphaFuncVal = value;
- if (func == CF_DEFAULT)
- {
- glAlphaFunc(GL_GREATER, 0.01f);
- }
- else
- {
- glAlphaFunc(sGLCompareFunc[func], value);
- }
- }
-
- if (gDebugGL)
- { //make sure cached state is correct
- GLint cur_func = 0;
- glGetIntegerv(GL_ALPHA_TEST_FUNC, &cur_func);
-
- if (func == CF_DEFAULT)
- {
- func = CF_GREATER;
- }
-
- if (cur_func != sGLCompareFunc[func])
- {
- LL_ERRS() << "Alpha test function corrupted!" << LL_ENDL;
- }
-
- F32 ref = 0.f;
- glGetFloatv(GL_ALPHA_TEST_REF, &ref);
-
- if (ref != value)
- {
- LL_ERRS() << "Alpha test value corrupted!" << LL_ENDL;
- }
- }
}
void LLRender::blendFunc(eBlendFactor sfactor, eBlendFactor dfactor)
@@ -1889,10 +1515,6 @@ void LLRender::setAmbientLightColor(const LLColor4& color)
{
++mLightHash;
mAmbientLightColor = color;
- if (!LLGLSLShader::sNoFixedFunction)
- {
- glLightModelfv(GL_LIGHT_MODEL_AMBIENT, color.mV);
- }
}
}
@@ -2345,7 +1967,7 @@ void LLRender::color3fv(const GLfloat* c)
void LLRender::diffuseColor3f(F32 r, F32 g, F32 b)
{
LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr;
- llassert(!LLGLSLShader::sNoFixedFunction || shader != NULL);
+ llassert(shader != NULL);
if (shader)
{
@@ -2360,7 +1982,7 @@ void LLRender::diffuseColor3f(F32 r, F32 g, F32 b)
void LLRender::diffuseColor3fv(const F32* c)
{
LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr;
- llassert(!LLGLSLShader::sNoFixedFunction || shader != NULL);
+ llassert(shader != NULL);
if (shader)
{
@@ -2375,7 +1997,7 @@ void LLRender::diffuseColor3fv(const F32* c)
void LLRender::diffuseColor4f(F32 r, F32 g, F32 b, F32 a)
{
LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr;
- llassert(!LLGLSLShader::sNoFixedFunction || shader != NULL);
+ llassert(shader != NULL);
if (shader)
{
@@ -2390,7 +2012,7 @@ void LLRender::diffuseColor4f(F32 r, F32 g, F32 b, F32 a)
void LLRender::diffuseColor4fv(const F32* c)
{
LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr;
- llassert(!LLGLSLShader::sNoFixedFunction || shader != NULL);
+ llassert(shader != NULL);
if (shader)
{
@@ -2405,7 +2027,7 @@ void LLRender::diffuseColor4fv(const F32* c)
void LLRender::diffuseColor4ubv(const U8* c)
{
LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr;
- llassert(!LLGLSLShader::sNoFixedFunction || shader != NULL);
+ llassert(shader != NULL);
if (shader)
{
@@ -2420,7 +2042,7 @@ void LLRender::diffuseColor4ubv(const U8* c)
void LLRender::diffuseColor4ub(U8 r, U8 g, U8 b, U8 a)
{
LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr;
- llassert(!LLGLSLShader::sNoFixedFunction || shader != NULL);
+ llassert(shader != NULL);
if (shader)
{
diff --git a/indra/llrender/llrender.h b/indra/llrender/llrender.h
index 7f19a45410..42aca6e665 100644
--- a/indra/llrender/llrender.h
+++ b/indra/llrender/llrender.h
@@ -204,11 +204,11 @@ public:
void setTextureBlendType(eTextureBlendType type);
inline void setTextureColorBlend(eTextureBlendOp op, eTextureBlendSrc src1, eTextureBlendSrc src2 = TBS_PREV_COLOR)
- { setTextureCombiner(op, src1, src2, false); }
+ { /* setTextureCombiner(op, src1, src2, false); */ }
// NOTE: If *_COLOR enums are passed to src1 or src2, the corresponding *_ALPHA enum will be used instead.
inline void setTextureAlphaBlend(eTextureBlendOp op, eTextureBlendSrc src1, eTextureBlendSrc src2 = TBS_PREV_ALPHA)
- { setTextureCombiner(op, src1, src2, true); }
+ { /* setTextureCombiner(op, src1, src2, true); */ }
static U32 getInternalType(eTextureType type);
@@ -243,7 +243,6 @@ protected:
void setAlphaScale(S32 scale);
GLint getTextureSource(eTextureBlendSrc src);
GLint getTextureSourceType(eTextureBlendSrc src, bool isAlpha = false);
- void setTextureCombiner(eTextureBlendOp op, eTextureBlendSrc src1, eTextureBlendSrc src2, bool isAlpha = false);
};
class LLLightState
diff --git a/indra/llrender/llrender2dutils.cpp b/indra/llrender/llrender2dutils.cpp
index 5a942996be..ad21bd4f48 100644
--- a/indra/llrender/llrender2dutils.cpp
+++ b/indra/llrender/llrender2dutils.cpp
@@ -395,15 +395,7 @@ void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 width, S32 height, LLTex
if (solid_color)
{
- if (LLGLSLShader::sNoFixedFunction)
- {
- gSolidColorProgram.bind();
- }
- else
- {
- gGL.getTexUnit(0)->setTextureColorBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_PREV_COLOR);
- gGL.getTexUnit(0)->setTextureAlphaBlend(LLTexUnit::TBO_MULT, LLTexUnit::TBS_TEX_ALPHA, LLTexUnit::TBS_VERT_ALPHA);
- }
+ gSolidColorProgram.bind();
}
if (center_rect.mLeft == 0.f
@@ -650,14 +642,7 @@ void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 width, S32 height, LLTex
if (solid_color)
{
- if (LLGLSLShader::sNoFixedFunction)
- {
- gUIProgram.bind();
- }
- else
- {
- gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT);
- }
+ gUIProgram.bind();
}
}
@@ -774,10 +759,6 @@ void gl_draw_scaled_rotated_image(S32 x, S32 y, S32 width, S32 height, F32 degre
void gl_stippled_line_3d( const LLVector3& start, const LLVector3& end, const LLColor4& color, F32 phase )
{
- phase = fmod(phase, 1.f);
-
- S32 shift = S32(phase * 4.f) % 4;
-
// Stippled line
LLGLEnable stipple(GL_LINE_STIPPLE);
@@ -786,11 +767,6 @@ void gl_stippled_line_3d( const LLVector3& start, const LLVector3& end, const LL
gGL.flush();
glLineWidth(2.5f);
- if (!LLGLSLShader::sNoFixedFunction)
- {
- glLineStipple(2, 0x3333 << shift);
- }
-
gGL.begin(LLRender::LINES);
{
gGL.vertex3fv( start.mV );
@@ -930,52 +906,16 @@ void gl_ring( F32 radius, F32 width, const LLColor4& center_color, const LLColor
// Draw gray and white checkerboard with black border
void gl_rect_2d_checkerboard(const LLRect& rect, GLfloat alpha)
{
- if (!LLGLSLShader::sNoFixedFunction)
- {
- // Initialize the first time this is called.
- const S32 PIXELS = 32;
- static GLubyte checkerboard[PIXELS * PIXELS];
- static BOOL first = TRUE;
- if( first )
- {
- for( S32 i = 0; i < PIXELS; i++ )
- {
- for( S32 j = 0; j < PIXELS; j++ )
- {
- checkerboard[i * PIXELS + j] = ((i & 1) ^ (j & 1)) * 0xFF;
- }
- }
- first = FALSE;
- }
-
- gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
+ //polygon stipple is deprecated, use "Checker" texture
+ LLPointer<LLUIImage> img = LLRender2D::getInstance()->getUIImage("Checker");
+ gGL.getTexUnit(0)->bind(img->getImage());
+ gGL.getTexUnit(0)->setTextureAddressMode(LLTexUnit::TAM_WRAP);
+ gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_POINT);
- // ...white squares
- gGL.color4f( 1.f, 1.f, 1.f, alpha );
- gl_rect_2d(rect);
+ LLColor4 color(1.f, 1.f, 1.f, alpha);
+ LLRectf uv_rect(0, 0, rect.getWidth()/32.f, rect.getHeight()/32.f);
- // ...gray squares
- gGL.color4f( .7f, .7f, .7f, alpha );
- gGL.flush();
-
- glPolygonStipple( checkerboard );
-
- LLGLEnable polygon_stipple(GL_POLYGON_STIPPLE);
- gl_rect_2d(rect);
- }
- else
- { //polygon stipple is deprecated, use "Checker" texture
- LLPointer<LLUIImage> img = LLRender2D::getInstance()->getUIImage("Checker");
- gGL.getTexUnit(0)->bind(img->getImage());
- gGL.getTexUnit(0)->setTextureAddressMode(LLTexUnit::TAM_WRAP);
- gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_POINT);
-
- LLColor4 color(1.f, 1.f, 1.f, alpha);
- LLRectf uv_rect(0, 0, rect.getWidth()/32.f, rect.getHeight()/32.f);
-
- gl_draw_scaled_image(rect.mLeft, rect.mBottom, rect.getWidth(), rect.getHeight(),
- img->getImage(), color, uv_rect);
- }
+ gl_draw_scaled_image(rect.mLeft, rect.mBottom, rect.getWidth(), rect.getHeight(), img->getImage(), color, uv_rect);
gGL.flush();
}
diff --git a/indra/llrender/llshadermgr.cpp b/indra/llrender/llshadermgr.cpp
index a9a4314afa..6a53662619 100644
--- a/indra/llrender/llshadermgr.cpp
+++ b/indra/llrender/llshadermgr.cpp
@@ -1054,43 +1054,6 @@ BOOL LLShaderMgr::linkProgramObject(GLhandleARB obj, BOOL suppress_errors)
LL_SHADER_LOADING_WARNS() << "GLSL Linker Error:" << LL_ENDL;
}
-#if LL_DARWIN
-
- // For some reason this absolutely kills the frame rate when VBO's are enabled
- if (0)
- {
- // Force an evaluation of the gl state so the driver can tell if the shader will run in hardware or software
- // per Apple's suggestion
- LLGLSLShader::sNoFixedFunction = false;
-
- glUseProgramObjectARB(obj);
-
- gGL.begin(LLRender::TRIANGLES);
- gGL.vertex3f(0.0f, 0.0f, 0.0f);
- gGL.vertex3f(0.0f, 0.0f, 0.0f);
- gGL.vertex3f(0.0f, 0.0f, 0.0f);
- gGL.end();
- gGL.flush();
-
- glUseProgramObjectARB(0);
-
- LLGLSLShader::sNoFixedFunction = true;
-
- // Query whether the shader can or cannot run in hardware
- // http://developer.apple.com/qa/qa2007/qa1502.html
- GLint vertexGPUProcessing, fragmentGPUProcessing;
- CGLContextObj ctx = CGLGetCurrentContext();
- CGLGetParameter(ctx, kCGLCPGPUVertexProcessing, &vertexGPUProcessing);
- CGLGetParameter(ctx, kCGLCPGPUFragmentProcessing, &fragmentGPUProcessing);
- if (!fragmentGPUProcessing || !vertexGPUProcessing)
- {
- LL_SHADER_LOADING_WARNS() << "GLSL Linker: Running in Software:" << LL_ENDL;
- success = GL_FALSE;
- suppress_errors = FALSE;
- }
- }
-
-#else
std::string log = get_object_log(obj);
LLStringUtil::toLower(log);
if (log.find("software") != std::string::npos)
@@ -1099,7 +1062,6 @@ BOOL LLShaderMgr::linkProgramObject(GLhandleARB obj, BOOL suppress_errors)
success = GL_FALSE;
suppress_errors = FALSE;
}
-#endif
return success;
}
diff --git a/indra/llrender/llvertexbuffer.cpp b/indra/llrender/llvertexbuffer.cpp
index 46654cc5b9..dcce5a5a1d 100644
--- a/indra/llrender/llvertexbuffer.cpp
+++ b/indra/llrender/llvertexbuffer.cpp
@@ -441,135 +441,26 @@ void LLVertexBuffer::setupClientArrays(U32 data_mask)
data_mask = data_mask & ~MAP_TEXTURE_INDEX;
}
- if (LLGLSLShader::sNoFixedFunction)
+ for (U32 i = 0; i < TYPE_MAX; ++i)
{
- for (U32 i = 0; i < TYPE_MAX; ++i)
- {
- S32 loc = i;
+ S32 loc = i;
- U32 mask = 1 << i;
-
- if (sLastMask & (1 << i))
- { //was enabled
- if (!(data_mask & mask))
- { //needs to be disabled
- glDisableVertexAttribArrayARB(loc);
- }
- }
- else
- { //was disabled
- if (data_mask & mask)
- { //needs to be enabled
- glEnableVertexAttribArrayARB(loc);
- }
- }
- }
- }
- else
- {
-
- static const GLenum array[] =
- {
- GL_VERTEX_ARRAY,
- GL_NORMAL_ARRAY,
- GL_TEXTURE_COORD_ARRAY,
- GL_COLOR_ARRAY,
- };
-
- static const GLenum mask[] =
- {
- MAP_VERTEX,
- MAP_NORMAL,
- MAP_TEXCOORD0,
- MAP_COLOR
- };
-
-
-
- for (U32 i = 0; i < 4; ++i)
- {
- if (sLastMask & mask[i])
- { //was enabled
- if (!(data_mask & mask[i]))
- { //needs to be disabled
- glDisableClientState(array[i]);
- }
- else if (gDebugGL)
- { //needs to be enabled, make sure it was (DEBUG)
- if (!glIsEnabled(array[i]))
- {
- if (gDebugSession)
- {
- gFailLog << "Bad client state! " << array[i] << " disabled." << std::endl;
- }
- else
- {
- LL_ERRS() << "Bad client state! " << array[i] << " disabled." << LL_ENDL;
- }
- }
- }
- }
- else
- { //was disabled
- if (data_mask & mask[i])
- { //needs to be enabled
- glEnableClientState(array[i]);
- }
- else if (gDebugGL && glIsEnabled(array[i]))
- { //needs to be disabled, make sure it was (DEBUG TEMPORARY)
- if (gDebugSession)
- {
- gFailLog << "Bad client state! " << array[i] << " enabled." << std::endl;
- }
- else
- {
- LL_ERRS() << "Bad client state! " << array[i] << " enabled." << LL_ENDL;
- }
- }
- }
- }
-
- static const U32 map_tc[] =
- {
- MAP_TEXCOORD1,
- MAP_TEXCOORD2,
- MAP_TEXCOORD3
- };
+ U32 mask = 1 << i;
- for (U32 i = 0; i < 3; i++)
- {
- if (sLastMask & map_tc[i])
- {
- if (!(data_mask & map_tc[i]))
- { //disable
- glClientActiveTextureARB(GL_TEXTURE1_ARB+i);
- glDisableClientState(GL_TEXTURE_COORD_ARRAY);
- glClientActiveTextureARB(GL_TEXTURE0_ARB);
- }
- }
- else if (data_mask & map_tc[i])
- {
- glClientActiveTextureARB(GL_TEXTURE1_ARB+i);
- glEnableClientState(GL_TEXTURE_COORD_ARRAY);
- glClientActiveTextureARB(GL_TEXTURE0_ARB);
+ if (sLastMask & (1 << i))
+ { //was enabled
+ if (!(data_mask & mask))
+ { //needs to be disabled
+ glDisableVertexAttribArrayARB(loc);
}
}
-
- if (sLastMask & MAP_TANGENT)
- {
- if (!(data_mask & MAP_TANGENT))
- {
- glClientActiveTextureARB(GL_TEXTURE2_ARB);
- glDisableClientState(GL_TEXTURE_COORD_ARRAY);
- glClientActiveTextureARB(GL_TEXTURE0_ARB);
+ else
+ { //was disabled
+ if (data_mask & mask)
+ { //needs to be enabled
+ glEnableVertexAttribArrayARB(loc);
}
}
- else if (data_mask & MAP_TANGENT)
- {
- glClientActiveTextureARB(GL_TEXTURE2_ARB);
- glEnableClientState(GL_TEXTURE_COORD_ARRAY);
- glClientActiveTextureARB(GL_TEXTURE0_ARB);
- }
}
sLastMask = data_mask;
@@ -593,7 +484,7 @@ void LLVertexBuffer::drawArrays(U32 mode, const std::vector<LLVector3>& pos)
void LLVertexBuffer::drawElements(U32 mode, const LLVector4a* pos, const LLVector2* tc, S32 num_indices, const U16* indicesp)
{
LL_PROFILE_ZONE_SCOPED;
- llassert(!LLGLSLShader::sNoFixedFunction || LLGLSLShader::sCurBoundShaderPtr != NULL);
+ llassert(LLGLSLShader::sCurBoundShaderPtr != NULL);
gGL.syncMatrices();
@@ -690,7 +581,7 @@ void LLVertexBuffer::drawRange(U32 mode, U32 start, U32 end, U32 count, U32 indi
gGL.syncMatrices();
llassert(mNumVerts >= 0);
- llassert(!LLGLSLShader::sNoFixedFunction || LLGLSLShader::sCurBoundShaderPtr != NULL);
+ llassert(LLGLSLShader::sCurBoundShaderPtr != NULL);
if (mGLArray)
{
@@ -758,7 +649,7 @@ void LLVertexBuffer::drawRangeFast(U32 mode, U32 start, U32 end, U32 count, U32
void LLVertexBuffer::draw(U32 mode, U32 count, U32 indices_offset) const
{
- llassert(!LLGLSLShader::sNoFixedFunction || LLGLSLShader::sCurBoundShaderPtr != NULL);
+ llassert(LLGLSLShader::sCurBoundShaderPtr != NULL);
mMappable = false;
gGL.syncMatrices();
@@ -809,7 +700,7 @@ void LLVertexBuffer::draw(U32 mode, U32 count, U32 indices_offset) const
void LLVertexBuffer::drawArrays(U32 mode, U32 first, U32 count) const
{
LL_PROFILE_ZONE_SCOPED;
- llassert(!LLGLSLShader::sNoFixedFunction || LLGLSLShader::sCurBoundShaderPtr != NULL);
+ llassert(LLGLSLShader::sCurBoundShaderPtr != NULL);
mMappable = false;
gGL.syncMatrices();
@@ -2499,140 +2390,94 @@ void LLVertexBuffer::setupVertexBuffer(U32 data_mask)
LL_ERRS() << "LLVertexBuffer::setupVertexBuffer missing required components for supplied data mask." << LL_ENDL;
}
- if (LLGLSLShader::sNoFixedFunction)
+ if (data_mask & MAP_NORMAL)
{
- if (data_mask & MAP_NORMAL)
- {
- S32 loc = TYPE_NORMAL;
- void* ptr = (void*)(base + mOffsets[TYPE_NORMAL]);
- glVertexAttribPointerARB(loc, 3, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_NORMAL], ptr);
- }
- if (data_mask & MAP_TEXCOORD3)
- {
- S32 loc = TYPE_TEXCOORD3;
- void* ptr = (void*)(base + mOffsets[TYPE_TEXCOORD3]);
- glVertexAttribPointerARB(loc,2,GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD3], ptr);
- }
- if (data_mask & MAP_TEXCOORD2)
- {
- S32 loc = TYPE_TEXCOORD2;
- void* ptr = (void*)(base + mOffsets[TYPE_TEXCOORD2]);
- glVertexAttribPointerARB(loc,2,GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD2], ptr);
- }
- if (data_mask & MAP_TEXCOORD1)
- {
- S32 loc = TYPE_TEXCOORD1;
- void* ptr = (void*)(base + mOffsets[TYPE_TEXCOORD1]);
- glVertexAttribPointerARB(loc,2,GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD1], ptr);
- }
- if (data_mask & MAP_TANGENT)
- {
- S32 loc = TYPE_TANGENT;
- void* ptr = (void*)(base + mOffsets[TYPE_TANGENT]);
- glVertexAttribPointerARB(loc, 4,GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_TANGENT], ptr);
- }
- if (data_mask & MAP_TEXCOORD0)
- {
- S32 loc = TYPE_TEXCOORD0;
- void* ptr = (void*)(base + mOffsets[TYPE_TEXCOORD0]);
- glVertexAttribPointerARB(loc,2,GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD0], ptr);
- }
- if (data_mask & MAP_COLOR)
- {
- S32 loc = TYPE_COLOR;
- //bind emissive instead of color pointer if emissive is present
- void* ptr = (data_mask & MAP_EMISSIVE) ? (void*)(base + mOffsets[TYPE_EMISSIVE]) : (void*)(base + mOffsets[TYPE_COLOR]);
- glVertexAttribPointerARB(loc, 4, GL_UNSIGNED_BYTE, GL_TRUE, LLVertexBuffer::sTypeSize[TYPE_COLOR], ptr);
- }
- if (data_mask & MAP_EMISSIVE)
- {
- S32 loc = TYPE_EMISSIVE;
- void* ptr = (void*)(base + mOffsets[TYPE_EMISSIVE]);
- glVertexAttribPointerARB(loc, 4, GL_UNSIGNED_BYTE, GL_TRUE, LLVertexBuffer::sTypeSize[TYPE_EMISSIVE], ptr);
+ S32 loc = TYPE_NORMAL;
+ void* ptr = (void*)(base + mOffsets[TYPE_NORMAL]);
+ glVertexAttribPointerARB(loc, 3, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_NORMAL], ptr);
+ }
+ if (data_mask & MAP_TEXCOORD3)
+ {
+ S32 loc = TYPE_TEXCOORD3;
+ void* ptr = (void*)(base + mOffsets[TYPE_TEXCOORD3]);
+ glVertexAttribPointerARB(loc,2,GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD3], ptr);
+ }
+ if (data_mask & MAP_TEXCOORD2)
+ {
+ S32 loc = TYPE_TEXCOORD2;
+ void* ptr = (void*)(base + mOffsets[TYPE_TEXCOORD2]);
+ glVertexAttribPointerARB(loc,2,GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD2], ptr);
+ }
+ if (data_mask & MAP_TEXCOORD1)
+ {
+ S32 loc = TYPE_TEXCOORD1;
+ void* ptr = (void*)(base + mOffsets[TYPE_TEXCOORD1]);
+ glVertexAttribPointerARB(loc,2,GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD1], ptr);
+ }
+ if (data_mask & MAP_TANGENT)
+ {
+ S32 loc = TYPE_TANGENT;
+ void* ptr = (void*)(base + mOffsets[TYPE_TANGENT]);
+ glVertexAttribPointerARB(loc, 4,GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_TANGENT], ptr);
+ }
+ if (data_mask & MAP_TEXCOORD0)
+ {
+ S32 loc = TYPE_TEXCOORD0;
+ void* ptr = (void*)(base + mOffsets[TYPE_TEXCOORD0]);
+ glVertexAttribPointerARB(loc,2,GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD0], ptr);
+ }
+ if (data_mask & MAP_COLOR)
+ {
+ S32 loc = TYPE_COLOR;
+ //bind emissive instead of color pointer if emissive is present
+ void* ptr = (data_mask & MAP_EMISSIVE) ? (void*)(base + mOffsets[TYPE_EMISSIVE]) : (void*)(base + mOffsets[TYPE_COLOR]);
+ glVertexAttribPointerARB(loc, 4, GL_UNSIGNED_BYTE, GL_TRUE, LLVertexBuffer::sTypeSize[TYPE_COLOR], ptr);
+ }
+ if (data_mask & MAP_EMISSIVE)
+ {
+ S32 loc = TYPE_EMISSIVE;
+ void* ptr = (void*)(base + mOffsets[TYPE_EMISSIVE]);
+ glVertexAttribPointerARB(loc, 4, GL_UNSIGNED_BYTE, GL_TRUE, LLVertexBuffer::sTypeSize[TYPE_EMISSIVE], ptr);
- if (!(data_mask & MAP_COLOR))
- { //map emissive to color channel when color is not also being bound to avoid unnecessary shader swaps
- loc = TYPE_COLOR;
- glVertexAttribPointerARB(loc, 4, GL_UNSIGNED_BYTE, GL_TRUE, LLVertexBuffer::sTypeSize[TYPE_EMISSIVE], ptr);
- }
- }
- if (data_mask & MAP_WEIGHT)
- {
- S32 loc = TYPE_WEIGHT;
- void* ptr = (void*)(base + mOffsets[TYPE_WEIGHT]);
- glVertexAttribPointerARB(loc, 1, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_WEIGHT], ptr);
- }
- if (data_mask & MAP_WEIGHT4)
- {
- S32 loc = TYPE_WEIGHT4;
- void* ptr = (void*)(base+mOffsets[TYPE_WEIGHT4]);
- glVertexAttribPointerARB(loc, 4, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_WEIGHT4], ptr);
- }
- if (data_mask & MAP_CLOTHWEIGHT)
- {
- S32 loc = TYPE_CLOTHWEIGHT;
- void* ptr = (void*)(base + mOffsets[TYPE_CLOTHWEIGHT]);
- glVertexAttribPointerARB(loc, 4, GL_FLOAT, GL_TRUE, LLVertexBuffer::sTypeSize[TYPE_CLOTHWEIGHT], ptr);
+ if (!(data_mask & MAP_COLOR))
+ { //map emissive to color channel when color is not also being bound to avoid unnecessary shader swaps
+ loc = TYPE_COLOR;
+ glVertexAttribPointerARB(loc, 4, GL_UNSIGNED_BYTE, GL_TRUE, LLVertexBuffer::sTypeSize[TYPE_EMISSIVE], ptr);
}
- if (data_mask & MAP_TEXTURE_INDEX &&
- (gGLManager.mGLSLVersionMajor >= 2 || gGLManager.mGLSLVersionMinor >= 30)) //indexed texture rendering requires GLSL 1.30 or later
- {
+ }
+ if (data_mask & MAP_WEIGHT)
+ {
+ S32 loc = TYPE_WEIGHT;
+ void* ptr = (void*)(base + mOffsets[TYPE_WEIGHT]);
+ glVertexAttribPointerARB(loc, 1, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_WEIGHT], ptr);
+ }
+ if (data_mask & MAP_WEIGHT4)
+ {
+ S32 loc = TYPE_WEIGHT4;
+ void* ptr = (void*)(base+mOffsets[TYPE_WEIGHT4]);
+ glVertexAttribPointerARB(loc, 4, GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_WEIGHT4], ptr);
+ }
+ if (data_mask & MAP_CLOTHWEIGHT)
+ {
+ S32 loc = TYPE_CLOTHWEIGHT;
+ void* ptr = (void*)(base + mOffsets[TYPE_CLOTHWEIGHT]);
+ glVertexAttribPointerARB(loc, 4, GL_FLOAT, GL_TRUE, LLVertexBuffer::sTypeSize[TYPE_CLOTHWEIGHT], ptr);
+ }
+ if (data_mask & MAP_TEXTURE_INDEX &&
+ (gGLManager.mGLSLVersionMajor >= 2 || gGLManager.mGLSLVersionMinor >= 30)) //indexed texture rendering requires GLSL 1.30 or later
+ {
#if !LL_DARWIN
- S32 loc = TYPE_TEXTURE_INDEX;
- void *ptr = (void*) (base + mOffsets[TYPE_VERTEX] + 12);
- glVertexAttribIPointer(loc, 1, GL_UNSIGNED_INT, LLVertexBuffer::sTypeSize[TYPE_VERTEX], ptr);
+ S32 loc = TYPE_TEXTURE_INDEX;
+ void *ptr = (void*) (base + mOffsets[TYPE_VERTEX] + 12);
+ glVertexAttribIPointer(loc, 1, GL_UNSIGNED_INT, LLVertexBuffer::sTypeSize[TYPE_VERTEX], ptr);
#endif
- }
- if (data_mask & MAP_VERTEX)
- {
- S32 loc = TYPE_VERTEX;
- void* ptr = (void*)(base + mOffsets[TYPE_VERTEX]);
- glVertexAttribPointerARB(loc, 3,GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_VERTEX], ptr);
- }
- }
- else
- {
- if (data_mask & MAP_NORMAL)
- {
- glNormalPointer(GL_FLOAT, LLVertexBuffer::sTypeSize[TYPE_NORMAL], (void*)(base + mOffsets[TYPE_NORMAL]));
- }
- if (data_mask & MAP_TEXCOORD3)
- {
- glClientActiveTextureARB(GL_TEXTURE3_ARB);
- glTexCoordPointer(2,GL_FLOAT, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD3], (void*)(base + mOffsets[TYPE_TEXCOORD3]));
- glClientActiveTextureARB(GL_TEXTURE0_ARB);
- }
- if (data_mask & MAP_TEXCOORD2)
- {
- glClientActiveTextureARB(GL_TEXTURE2_ARB);
- glTexCoordPointer(2,GL_FLOAT, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD2], (void*)(base + mOffsets[TYPE_TEXCOORD2]));
- glClientActiveTextureARB(GL_TEXTURE0_ARB);
- }
- if (data_mask & MAP_TEXCOORD1)
- {
- glClientActiveTextureARB(GL_TEXTURE1_ARB);
- glTexCoordPointer(2,GL_FLOAT, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD1], (void*)(base + mOffsets[TYPE_TEXCOORD1]));
- glClientActiveTextureARB(GL_TEXTURE0_ARB);
- }
- if (data_mask & MAP_TANGENT)
- {
- glClientActiveTextureARB(GL_TEXTURE2_ARB);
- glTexCoordPointer(4,GL_FLOAT, LLVertexBuffer::sTypeSize[TYPE_TANGENT], (void*)(base + mOffsets[TYPE_TANGENT]));
- glClientActiveTextureARB(GL_TEXTURE0_ARB);
- }
- if (data_mask & MAP_TEXCOORD0)
- {
- glTexCoordPointer(2,GL_FLOAT, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD0], (void*)(base + mOffsets[TYPE_TEXCOORD0]));
- }
- if (data_mask & MAP_COLOR)
- {
- glColorPointer(4, GL_UNSIGNED_BYTE, LLVertexBuffer::sTypeSize[TYPE_COLOR], (void*)(base + mOffsets[TYPE_COLOR]));
- }
- if (data_mask & MAP_VERTEX)
- {
- glVertexPointer(3,GL_FLOAT, LLVertexBuffer::sTypeSize[TYPE_VERTEX], (void*)(base + 0));
- }
}
+ if (data_mask & MAP_VERTEX)
+ {
+ S32 loc = TYPE_VERTEX;
+ void* ptr = (void*)(base + mOffsets[TYPE_VERTEX]);
+ glVertexAttribPointerARB(loc, 3,GL_FLOAT, GL_FALSE, LLVertexBuffer::sTypeSize[TYPE_VERTEX], ptr);
+ }
llglassertok();
}
diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp
index 062dd02903..b8bfa92279 100644
--- a/indra/llwindow/llwindowwin32.cpp
+++ b/indra/llwindow/llwindowwin32.cpp
@@ -1798,14 +1798,6 @@ void* LLWindowWin32::createSharedContext()
LL_INFOS() << "Created OpenGL " << llformat("%d.%d", attribs[1], attribs[3]) <<
(LLRender::sGLCoreProfile ? " core" : " compatibility") << " context." << LL_ENDL;
done = true;
-
- // force sNoFixedFunction iff we're trying to use nsight debugging which does not support many legacy API uses
-
- // nSight doesn't support use of legacy API funcs in the fixed function pipe
- if (LLRender::sGLCoreProfile || LLRender::sNsightDebugSupport)
- {
- LLGLSLShader::sNoFixedFunction = true;
- }
}
}
diff --git a/indra/newview/lldrawpoolavatar.cpp b/indra/newview/lldrawpoolavatar.cpp
index 125cd3fd5b..f9fdbac9ab 100644
--- a/indra/newview/lldrawpoolavatar.cpp
+++ b/indra/newview/lldrawpoolavatar.cpp
@@ -497,11 +497,8 @@ void LLDrawPoolAvatar::beginImpostor()
LLVOAvatar::sNumVisibleAvatars = 0;
}
- if (LLGLSLShader::sNoFixedFunction)
- {
- gImpostorProgram.bind();
- gImpostorProgram.setMinimumAlpha(0.01f);
- }
+ gImpostorProgram.bind();
+ gImpostorProgram.setMinimumAlpha(0.01f);
gPipeline.enableLightsFullbright();
sDiffuseChannel = 0;
@@ -511,10 +508,7 @@ void LLDrawPoolAvatar::endImpostor()
{
LL_PROFILE_ZONE_SCOPED
- if (LLGLSLShader::sNoFixedFunction)
- {
- gImpostorProgram.unbind();
- }
+ gImpostorProgram.unbind();
gPipeline.enableLightsDynamic();
}
@@ -686,10 +680,7 @@ void LLDrawPoolAvatar::beginSkinned()
}
}
- if (LLGLSLShader::sNoFixedFunction)
- {
- sVertexProgram->setMinimumAlpha(LLDrawPoolAvatar::sMinimumAlpha);
- }
+ sVertexProgram->setMinimumAlpha(LLDrawPoolAvatar::sMinimumAlpha);
}
void LLDrawPoolAvatar::endSkinned()
diff --git a/indra/newview/lldrawpoolbump.cpp b/indra/newview/lldrawpoolbump.cpp
index af8b194f38..2d26ee9f65 100644
--- a/indra/newview/lldrawpoolbump.cpp
+++ b/indra/newview/lldrawpoolbump.cpp
@@ -745,23 +745,9 @@ void LLDrawPoolBump::renderBump(U32 pass)
//static
void LLDrawPoolBump::endBump(U32 pass)
{
- if (LLGLSLShader::sNoFixedFunction)
- {
- gObjectBumpProgram.unbind();
- }
- else
- {
- // Disable texture blending on unit 1
- gGL.getTexUnit(1)->activate();
- gGL.getTexUnit(1)->disable();
- gGL.getTexUnit(1)->setTextureBlendType(LLTexUnit::TB_MULT);
+ gObjectBumpProgram.unbind();
- // Disable texture blending on unit 0
- gGL.getTexUnit(0)->activate();
- gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT);
- }
-
- gGL.setSceneBlendType(LLRender::BT_ALPHA);
+ gGL.setSceneBlendType(LLRender::BT_ALPHA);
}
S32 LLDrawPoolBump::getNumDeferredPasses()
diff --git a/indra/newview/lldrawpoolsky.cpp b/indra/newview/lldrawpoolsky.cpp
index b1eefaab81..3a1efec91b 100644
--- a/indra/newview/lldrawpoolsky.cpp
+++ b/indra/newview/lldrawpoolsky.cpp
@@ -76,16 +76,8 @@ void LLDrawPoolSky::render(S32 pass)
}
- if (LLGLSLShader::sNoFixedFunction)
- { //just use the UI shader (generic single texture no lighting)
- gOneTextureNoColorProgram.bind();
- }
- else
- {
- LLGLSLShader::bindNoShader();
- mShader = NULL;
- }
-
+ //just use the UI shader (generic single texture no lighting)
+ gOneTextureNoColorProgram.bind();
LLGLSPipelineDepthTestSkyBox gls_skybox(true, false);
diff --git a/indra/newview/lldrawpoolterrain.cpp b/indra/newview/lldrawpoolterrain.cpp
index 9cea8f5460..c71ebaffb9 100644
--- a/indra/newview/lldrawpoolterrain.cpp
+++ b/indra/newview/lldrawpoolterrain.cpp
@@ -837,20 +837,8 @@ void LLDrawPoolTerrain::renderSimple()
tp0.setVec(tscale, 0.f, 0.0f, -1.f*(origin_agent.mV[0]/256.f));
tp1.setVec(0.f, tscale, 0.0f, -1.f*(origin_agent.mV[1]/256.f));
- if (LLGLSLShader::sNoFixedFunction)
- {
- sShader->uniform4fv(LLShaderMgr::OBJECT_PLANE_S, 1, tp0.mV);
- sShader->uniform4fv(LLShaderMgr::OBJECT_PLANE_T, 1, tp1.mV);
- }
- else
- {
- glEnable(GL_TEXTURE_GEN_S);
- glEnable(GL_TEXTURE_GEN_T);
- glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
- glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
- glTexGenfv(GL_S, GL_OBJECT_PLANE, tp0.mV);
- glTexGenfv(GL_T, GL_OBJECT_PLANE, tp1.mV);
- }
+ sShader->uniform4fv(LLShaderMgr::OBJECT_PLANE_S, 1, tp0.mV);
+ sShader->uniform4fv(LLShaderMgr::OBJECT_PLANE_T, 1, tp1.mV);
gGL.getTexUnit(0)->setTextureColorBlend(LLTexUnit::TBO_MULT, LLTexUnit::TBS_TEX_COLOR, LLTexUnit::TBS_VERT_COLOR);
@@ -861,11 +849,6 @@ void LLDrawPoolTerrain::renderSimple()
gGL.getTexUnit(0)->activate();
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
- if (!LLGLSLShader::sNoFixedFunction)
- {
- glDisable(GL_TEXTURE_GEN_S);
- glDisable(GL_TEXTURE_GEN_T);
- }
gGL.matrixMode(LLRender::MM_TEXTURE);
gGL.loadIdentity();
gGL.matrixMode(LLRender::MM_MODELVIEW);
diff --git a/indra/newview/lldrawpooltree.cpp b/indra/newview/lldrawpooltree.cpp
index 202f648e3f..e93852864e 100644
--- a/indra/newview/lldrawpooltree.cpp
+++ b/indra/newview/lldrawpooltree.cpp
@@ -90,7 +90,7 @@ void LLDrawPoolTree::render(S32 pass)
return;
}
- LLGLState test(GL_ALPHA_TEST, LLGLSLShader::sNoFixedFunction ? 0 : 1);
+ LLGLState test(GL_ALPHA_TEST, 0);
gGL.getTexUnit(sDiffTex)->bind(mTexturep);
diff --git a/indra/newview/lldrawpoolwater.cpp b/indra/newview/lldrawpoolwater.cpp
index e2d3f67e46..c0e82ead43 100644
--- a/indra/newview/lldrawpoolwater.cpp
+++ b/indra/newview/lldrawpoolwater.cpp
@@ -352,19 +352,16 @@ void LLDrawPoolWater::renderOpaqueLegacyWater()
}
LLGLSLShader* shader = NULL;
- if (LLGLSLShader::sNoFixedFunction)
+ if (LLPipeline::sUnderWaterRender)
{
- if (LLPipeline::sUnderWaterRender)
- {
- shader = &gObjectSimpleNonIndexedTexGenWaterProgram;
- }
- else
- {
- shader = &gObjectSimpleNonIndexedTexGenProgram;
- }
-
- shader->bind();
+ shader = &gObjectSimpleNonIndexedTexGenWaterProgram;
}
+ else
+ {
+ shader = &gObjectSimpleNonIndexedTexGenProgram;
+ }
+
+ shader->bind();
stop_glerror();
diff --git a/indra/newview/lldrawpoolwlsky.cpp b/indra/newview/lldrawpoolwlsky.cpp
index 8c8dc3f3d2..44b12ceaca 100644
--- a/indra/newview/lldrawpoolwlsky.cpp
+++ b/indra/newview/lldrawpoolwlsky.cpp
@@ -266,33 +266,14 @@ void LLDrawPoolWLSky::renderStars(const LLVector3& camPosLocal) const
gGL.pushMatrix();
gGL.translatef(camPosLocal.mV[0], camPosLocal.mV[1], camPosLocal.mV[2]);
gGL.rotatef(gFrameTimeSeconds*0.01f, 0.f, 0.f, 1.f);
- if (LLGLSLShader::sNoFixedFunction)
- {
- gCustomAlphaProgram.bind();
- gCustomAlphaProgram.uniform1f(sCustomAlpha, star_alpha.mV[3]);
- }
- else
- {
- gGL.getTexUnit(0)->setTextureColorBlend(LLTexUnit::TBO_MULT, LLTexUnit::TBS_TEX_COLOR, LLTexUnit::TBS_VERT_COLOR);
- gGL.getTexUnit(0)->setTextureAlphaBlend(LLTexUnit::TBO_MULT_X2, LLTexUnit::TBS_CONST_ALPHA, LLTexUnit::TBS_TEX_ALPHA);
- glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, star_alpha.mV);
- }
+ gCustomAlphaProgram.bind();
+ gCustomAlphaProgram.uniform1f(sCustomAlpha, star_alpha.mV[3]);
gSky.mVOWLSkyp->drawStars();
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
-
gGL.popMatrix();
-
- if (LLGLSLShader::sNoFixedFunction)
- {
- gCustomAlphaProgram.unbind();
- }
- else
- {
- // and disable the combiner states
- gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT);
- }
+ gCustomAlphaProgram.unbind();
}
void LLDrawPoolWLSky::renderStarsDeferred(const LLVector3& camPosLocal) const
diff --git a/indra/newview/llfloaterbvhpreview.cpp b/indra/newview/llfloaterbvhpreview.cpp
index 131d9b077b..4f0d8b8eb0 100644
--- a/indra/newview/llfloaterbvhpreview.cpp
+++ b/indra/newview/llfloaterbvhpreview.cpp
@@ -1088,10 +1088,7 @@ BOOL LLPreviewAnimation::render()
gGL.pushMatrix();
gGL.loadIdentity();
- if (LLGLSLShader::sNoFixedFunction)
- {
- gUIProgram.bind();
- }
+ gUIProgram.bind();
LLGLSUIDefault def;
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
diff --git a/indra/newview/llfloaterimagepreview.cpp b/indra/newview/llfloaterimagepreview.cpp
index 028c922a4d..89ba687d25 100644
--- a/indra/newview/llfloaterimagepreview.cpp
+++ b/indra/newview/llfloaterimagepreview.cpp
@@ -664,10 +664,7 @@ BOOL LLImagePreviewAvatar::render()
LLGLSUIDefault def;
gGL.color4f(0.15f, 0.2f, 0.3f, 1.f);
- if (LLGLSLShader::sNoFixedFunction)
- {
- gUIProgram.bind();
- }
+ gUIProgram.bind();
gl_rect_2d_simple( mFullWidth, mFullHeight );
@@ -866,10 +863,7 @@ BOOL LLImagePreviewSculpted::render()
gGL.color4f(0.15f, 0.2f, 0.3f, 1.f);
- if (LLGLSLShader::sNoFixedFunction)
- {
- gUIProgram.bind();
- }
+ gUIProgram.bind();
gl_rect_2d_simple( mFullWidth, mFullHeight );
@@ -903,10 +897,7 @@ BOOL LLImagePreviewSculpted::render()
gPipeline.enableLightsAvatar();
- if (LLGLSLShader::sNoFixedFunction)
- {
- gObjectPreviewProgram.bind();
- }
+ gObjectPreviewProgram.bind();
gPipeline.enableLightsPreview();
gGL.pushMatrix();
@@ -920,10 +911,7 @@ BOOL LLImagePreviewSculpted::render()
gGL.popMatrix();
- if (LLGLSLShader::sNoFixedFunction)
- {
- gObjectPreviewProgram.unbind();
- }
+ gObjectPreviewProgram.unbind();
return TRUE;
}
diff --git a/indra/newview/llglsandbox.cpp b/indra/newview/llglsandbox.cpp
index 91f314c115..a135ef0814 100644
--- a/indra/newview/llglsandbox.cpp
+++ b/indra/newview/llglsandbox.cpp
@@ -791,10 +791,7 @@ void LLViewerObjectList::renderObjectBeacons()
LLGLSUIDefault gls_ui;
- if (LLGLSLShader::sNoFixedFunction)
- {
- gUIProgram.bind();
- }
+ gUIProgram.bind();
{
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
@@ -882,10 +879,7 @@ void LLViewerObjectList::renderObjectBeacons()
void LLSky::renderSunMoonBeacons(const LLVector3& pos_agent, const LLVector3& direction, LLColor4 color)
{
LLGLSUIDefault gls_ui;
- if (LLGLSLShader::sNoFixedFunction)
- {
- gUIProgram.bind();
- }
+ gUIProgram.bind();
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
LLVector3 pos_end;
diff --git a/indra/newview/llhudtext.cpp b/indra/newview/llhudtext.cpp
index 7c957ac712..d01d25a75b 100644
--- a/indra/newview/llhudtext.cpp
+++ b/indra/newview/llhudtext.cpp
@@ -573,7 +573,6 @@ void LLHUDText::renderAllHUD()
{
LLGLState::checkStates();
LLGLState::checkTextureChannels();
- LLGLState::checkClientArrays();
{
LLGLEnable color_mat(GL_COLOR_MATERIAL);
@@ -591,7 +590,6 @@ void LLHUDText::renderAllHUD()
LLGLState::checkStates();
LLGLState::checkTextureChannels();
- LLGLState::checkClientArrays();
}
void LLHUDText::shiftAll(const LLVector3& offset)
diff --git a/indra/newview/lllegacyatmospherics.cpp b/indra/newview/lllegacyatmospherics.cpp
index 238e9fe0e1..1364067949 100644
--- a/indra/newview/lllegacyatmospherics.cpp
+++ b/indra/newview/lllegacyatmospherics.cpp
@@ -383,12 +383,6 @@ void LLAtmospherics::updateFog(const F32 distance, const LLVector3& tosun_in)
if (!gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_FOG))
{
- if (!LLGLSLShader::sNoFixedFunction)
- {
- glFogf(GL_FOG_DENSITY, 0);
- glFogfv(GL_FOG_COLOR, (F32 *) &LLColor4::white.mV);
- glFogf(GL_FOG_END, 1000000.f);
- }
return;
}
@@ -484,10 +478,6 @@ void LLAtmospherics::updateFog(const F32 distance, const LLVector3& tosun_in)
if (camera_height > water_height)
{
LLColor4 fog(render_fog_color);
- if (!LLGLSLShader::sNoFixedFunction)
- {
- glFogfv(GL_FOG_COLOR, fog.mV);
- }
mGLFogCol = fog;
if (hide_clip_plane)
@@ -495,19 +485,11 @@ void LLAtmospherics::updateFog(const F32 distance, const LLVector3& tosun_in)
// For now, set the density to extend to the cull distance.
const F32 f_log = 2.14596602628934723963618357029f; // sqrt(fabs(log(0.01f)))
fog_density = f_log/fog_distance;
- if (!LLGLSLShader::sNoFixedFunction)
- {
- glFogi(GL_FOG_MODE, GL_EXP2);
- }
}
else
{
const F32 f_log = 4.6051701859880913680359829093687f; // fabs(log(0.01f))
fog_density = (f_log)/fog_distance;
- if (!LLGLSLShader::sNoFixedFunction)
- {
- glFogi(GL_FOG_MODE, GL_EXP);
- }
}
}
else
@@ -533,12 +515,6 @@ void LLAtmospherics::updateFog(const F32 distance, const LLVector3& tosun_in)
// set the density based on what the shaders use
fog_density = water_fog_density * gSavedSettings.getF32("WaterGLFogDensityScale");
-
- if (!LLGLSLShader::sNoFixedFunction)
- {
- glFogfv(GL_FOG_COLOR, (F32 *) &fogCol.mV);
- glFogi(GL_FOG_MODE, GL_EXP2);
- }
}
mFogColor = sky_fog_color;
@@ -546,13 +522,6 @@ void LLAtmospherics::updateFog(const F32 distance, const LLVector3& tosun_in)
LLDrawPoolWater::sWaterFogEnd = fog_distance*2.2f;
- if (!LLGLSLShader::sNoFixedFunction)
- {
- LLGLSFog gls_fog;
- glFogf(GL_FOG_END, fog_distance*2.2f);
- glFogf(GL_FOG_DENSITY, fog_density);
- glHint(GL_FOG_HINT, GL_NICEST);
- }
stop_glerror();
}
diff --git a/indra/newview/llmaniprotate.cpp b/indra/newview/llmaniprotate.cpp
index 7c942e8b53..452762b09d 100644
--- a/indra/newview/llmaniprotate.cpp
+++ b/indra/newview/llmaniprotate.cpp
@@ -157,10 +157,7 @@ void LLManipRotate::render()
}
else
{
- if (LLGLSLShader::sNoFixedFunction)
- {
- gDebugProgram.bind();
- }
+ gDebugProgram.bind();
LLGLEnable cull_face(GL_CULL_FACE);
LLGLDepthTest gls_depth(GL_FALSE);
@@ -213,10 +210,7 @@ void LLManipRotate::render()
}
gGL.popMatrix();
- if (LLGLSLShader::sNoFixedFunction)
- {
- gUIProgram.bind();
- }
+ gUIProgram.bind();
}
gGL.translatef( center.mV[VX], center.mV[VY], center.mV[VZ] );
@@ -234,10 +228,7 @@ void LLManipRotate::render()
gGL.rotatef(angle_radians * RAD_TO_DEG, x, y, z);
- if (LLGLSLShader::sNoFixedFunction)
- {
- gDebugProgram.bind();
- }
+ gDebugProgram.bind();
if (mManipPart == LL_ROT_Z)
{
@@ -355,11 +346,7 @@ void LLManipRotate::render()
}
- if (LLGLSLShader::sNoFixedFunction)
- {
- gUIProgram.bind();
- }
-
+ gUIProgram.bind();
}
gGL.popMatrix();
gGL.popMatrix();
diff --git a/indra/newview/llmaniptranslate.cpp b/indra/newview/llmaniptranslate.cpp
index 8736d3b51f..0b2a1ef389 100644
--- a/indra/newview/llmaniptranslate.cpp
+++ b/indra/newview/llmaniptranslate.cpp
@@ -1565,11 +1565,6 @@ void LLManipTranslate::renderSnapGuides()
LLGLEnable stipple(GL_LINE_STIPPLE);
gGL.flush();
- if (!LLGLSLShader::sNoFixedFunction)
- {
- glLineStipple(1, 0x3333);
- }
-
switch (mManipPart)
{
case LL_YZ_PLANE:
@@ -1633,7 +1628,7 @@ void LLManipTranslate::highlightIntersection(LLVector3 normal,
LLQuaternion grid_rotation,
LLColor4 inner_color)
{
- if (!gSavedSettings.getBOOL("GridCrossSections") || !LLGLSLShader::sNoFixedFunction)
+ if (!gSavedSettings.getBOOL("GridCrossSections"))
{
return;
}
diff --git a/indra/newview/llmodelpreview.cpp b/indra/newview/llmodelpreview.cpp
index d7e9e234ca..566a89e24d 100644
--- a/indra/newview/llmodelpreview.cpp
+++ b/indra/newview/llmodelpreview.cpp
@@ -2886,8 +2886,6 @@ BOOL LLModelPreview::render()
LLMutexLock lock(this);
mNeedsUpdate = FALSE;
- bool use_shaders = LLGLSLShader::sNoFixedFunction;
-
bool edges = mViewOption["show_edges"];
bool joint_overrides = mViewOption["show_joint_overrides"];
bool joint_positions = mViewOption["show_joint_positions"];
@@ -2905,10 +2903,8 @@ BOOL LLModelPreview::render()
LLGLDisable fog(GL_FOG);
{
- if (use_shaders)
- {
- gUIProgram.bind();
- }
+ gUIProgram.bind();
+
//clear background to grey
gGL.matrixMode(LLRender::MM_PROJECTION);
gGL.pushMatrix();
@@ -2927,10 +2923,7 @@ BOOL LLModelPreview::render()
gGL.matrixMode(LLRender::MM_MODELVIEW);
gGL.popMatrix();
- if (use_shaders)
- {
- gUIProgram.unbind();
- }
+ gUIProgram.unbind();
}
LLFloaterModelPreview* fmp = LLFloaterModelPreview::sInstance;
@@ -3083,10 +3076,7 @@ BOOL LLModelPreview::render()
refresh();
}
- if (use_shaders)
- {
- gObjectPreviewProgram.bind();
- }
+ gObjectPreviewProgram.bind();
gGL.loadIdentity();
gPipeline.enableLightsPreview();
@@ -3587,10 +3577,7 @@ BOOL LLModelPreview::render()
}
}
- if (use_shaders)
- {
- gObjectPreviewProgram.unbind();
- }
+ gObjectPreviewProgram.unbind();
gGL.popMatrix();
diff --git a/indra/newview/llscenemonitor.cpp b/indra/newview/llscenemonitor.cpp
index 177bc84cee..2e44dc1459 100644
--- a/indra/newview/llscenemonitor.cpp
+++ b/indra/newview/llscenemonitor.cpp
@@ -271,7 +271,7 @@ void LLSceneMonitor::capture()
static LLCachedControl<F32> scene_load_sample_time(gSavedSettings, "SceneLoadingMonitorSampleTime");
static bool force_capture = true;
- bool enabled = LLGLSLShader::sNoFixedFunction && (monitor_enabled || mDebugViewerVisible);
+ bool enabled = monitor_enabled || mDebugViewerVisible;
if(mEnabled != enabled)
{
if(mEnabled)
@@ -719,13 +719,6 @@ void LLSceneMonitorView::onTeleportFinished()
void LLSceneMonitorView::onVisibilityChange(BOOL visible)
{
- if (!LLGLSLShader::sNoFixedFunction && visible)
- {
- visible = false;
- // keep Scene monitor and its view in sycn
- setVisible(false);
- LL_WARNS("SceneMonitor") << "Incompatible graphical settings, Scene Monitor can't be turned on" << LL_ENDL;
- }
LLSceneMonitor::getInstance()->setDebugViewerVisible(visible);
}
diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp
index 332fa73944..25d6106361 100644
--- a/indra/newview/llspatialpartition.cpp
+++ b/indra/newview/llspatialpartition.cpp
@@ -2612,7 +2612,7 @@ void renderPhysicsShape(LLDrawable* drawable, LLVOVolume* volume)
gGL.diffuseColor4fv(line_color.mV);
LLVertexBuffer::unbind();
- llassert(!LLGLSLShader::sNoFixedFunction || LLGLSLShader::sCurBoundShader != 0);
+ llassert(LLGLSLShader::sCurBoundShader != 0);
LLVertexBuffer::drawElements(LLRender::TRIANGLES, phys_volume->mHullPoints, NULL, phys_volume->mNumHullIndices, phys_volume->mHullIndices);
@@ -2694,7 +2694,7 @@ void renderPhysicsShape(LLDrawable* drawable, LLVOVolume* volume)
if (phys_volume->mHullPoints && phys_volume->mHullIndices)
{
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
- llassert(!LLGLSLShader::sNoFixedFunction || LLGLSLShader::sCurBoundShader != 0);
+ llassert(LLGLSLShader::sCurBoundShader != 0);
LLVertexBuffer::unbind();
glVertexPointer(3, GL_FLOAT, 16, phys_volume->mHullPoints);
gGL.diffuseColor4fv(line_color.mV);
@@ -3796,10 +3796,7 @@ void LLSpatialPartition::renderDebug()
return;
}
- if (LLGLSLShader::sNoFixedFunction)
- {
- gDebugProgram.bind();
- }
+ gDebugProgram.bind();
if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_TEXTURE_PRIORITY))
{
@@ -3848,10 +3845,7 @@ void LLSpatialPartition::renderDebug()
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
}
}
- if (LLGLSLShader::sNoFixedFunction)
- {
- gDebugProgram.unbind();
- }
+ gDebugProgram.unbind();
}
void LLSpatialGroup::drawObjectBox(LLColor4 col)
diff --git a/indra/newview/lltoolmorph.cpp b/indra/newview/lltoolmorph.cpp
index 06a2caf75b..9f0198029a 100644
--- a/indra/newview/lltoolmorph.cpp
+++ b/indra/newview/lltoolmorph.cpp
@@ -195,10 +195,7 @@ BOOL LLVisualParamHint::render()
gGL.pushMatrix();
gGL.loadIdentity();
- if (LLGLSLShader::sNoFixedFunction)
- {
- gUIProgram.bind();
- }
+ gUIProgram.bind();
LLGLSUIDefault gls_ui;
//LLGLState::verify(TRUE);
diff --git a/indra/newview/llviewercontrol.cpp b/indra/newview/llviewercontrol.cpp
index 3c6c9c905a..19b25a01fe 100644
--- a/indra/newview/llviewercontrol.cpp
+++ b/indra/newview/llviewercontrol.cpp
@@ -388,7 +388,7 @@ static bool handleJoystickChanged(const LLSD& newvalue)
static bool handleUseOcclusionChanged(const LLSD& newvalue)
{
- LLPipeline::sUseOcclusion = (newvalue.asBoolean() && gGLManager.mHasOcclusionQuery && LLGLSLShader::sNoFixedFunction
+ LLPipeline::sUseOcclusion = (newvalue.asBoolean() && gGLManager.mHasOcclusionQuery
&& LLFeatureManager::getInstance()->isFeatureAvailable("UseOcclusion") && !gUseWireframe) ? 2 : 0;
return true;
}
diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp
index 38ac4275cf..60ba07d3af 100644
--- a/indra/newview/llviewerdisplay.cpp
+++ b/indra/newview/llviewerdisplay.cpp
@@ -717,7 +717,6 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)
LLGLState::checkStates();
LLGLState::checkTextureChannels();
- LLGLState::checkClientArrays();
static LLCullResult result;
LLViewerCamera::sCurCameraID = LLViewerCamera::CAMERA_WORLD;
@@ -727,8 +726,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)
LLGLState::checkStates();
LLGLState::checkTextureChannels();
- LLGLState::checkClientArrays();
-
+
LLAppViewer::instance()->pingMainloopTimeout("Display:Swap");
{
@@ -744,7 +742,6 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)
LLGLState::checkStates();
LLGLState::checkTextureChannels();
- LLGLState::checkClientArrays();
if (!for_snapshot)
{
@@ -758,7 +755,6 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)
LLGLState::checkStates();
LLGLState::checkTextureChannels();
- LLGLState::checkClientArrays();
glh::matrix4f proj = get_current_projection();
glh::matrix4f mod = get_current_modelview();
@@ -777,14 +773,12 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)
LLGLState::checkStates();
LLGLState::checkTextureChannels();
- LLGLState::checkClientArrays();
}
glClear(GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
}
LLGLState::checkStates();
- LLGLState::checkClientArrays();
//if (!for_snapshot)
{
@@ -796,7 +790,6 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)
}
LLGLState::checkStates();
- LLGLState::checkClientArrays();
//////////////////////////////////////
//
@@ -836,7 +829,6 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)
}
LLGLState::checkStates();
- LLGLState::checkClientArrays();
///////////////////////////////////
//
@@ -868,7 +860,6 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)
LLSceneMonitor::getInstance()->fetchQueryResult();
LLGLState::checkStates();
- LLGLState::checkClientArrays();
LLPipeline::sUseOcclusion = occlusion;
@@ -927,7 +918,6 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)
LLPipeline::sUnderWaterRender = LLViewerCamera::getInstance()->cameraUnderWater() ? TRUE : FALSE;
LLGLState::checkStates();
- LLGLState::checkClientArrays();
stop_glerror();
@@ -960,7 +950,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)
LL_PROFILE_ZONE_NAMED("display - 4")
LLViewerCamera::sCurCameraID = LLViewerCamera::CAMERA_WORLD;
- if (gSavedSettings.getBOOL("RenderDepthPrePass") && LLGLSLShader::sNoFixedFunction)
+ if (gSavedSettings.getBOOL("RenderDepthPrePass"))
{
gGL.setColorMask(false, false);
@@ -1450,10 +1440,7 @@ void render_ui_3d()
stop_glerror();
- if (LLGLSLShader::sNoFixedFunction)
- {
- gUIProgram.bind();
- }
+ gUIProgram.bind();
// Coordinate axes
if (gSavedSettings.getBOOL("ShowAxes"))
@@ -1583,10 +1570,7 @@ void render_ui_2d()
void render_disconnected_background()
{
- if (LLGLSLShader::sNoFixedFunction)
- {
- gUIProgram.bind();
- }
+ gUIProgram.bind();
gGL.color4f(1,1,1,1);
if (!gDisconnectedImagep && gDisconnected)
@@ -1658,11 +1642,7 @@ void render_disconnected_background()
}
gGL.flush();
- if (LLGLSLShader::sNoFixedFunction)
- {
- gUIProgram.unbind();
- }
-
+ gUIProgram.unbind();
}
void display_cleanup()
diff --git a/indra/newview/llviewerjointmesh.cpp b/indra/newview/llviewerjointmesh.cpp
index 3e385a46e4..98d8f91116 100644
--- a/indra/newview/llviewerjointmesh.cpp
+++ b/indra/newview/llviewerjointmesh.cpp
@@ -225,7 +225,7 @@ U32 LLViewerJointMesh::drawShape( F32 pixelArea, BOOL first_pass, BOOL is_dummy)
if (!mValid || !mMesh || !mFace || !mVisible ||
!mFace->getVertexBuffer() ||
mMesh->getNumFaces() == 0 ||
- (LLGLSLShader::sNoFixedFunction && LLGLSLShader::sCurBoundShaderPtr == NULL))
+ LLGLSLShader::sCurBoundShaderPtr == NULL)
{
return 0;
}
@@ -246,7 +246,7 @@ U32 LLViewerJointMesh::drawShape( F32 pixelArea, BOOL first_pass, BOOL is_dummy)
stop_glerror();
- LLGLSSpecular specular(LLColor4(1.f,1.f,1.f,1.f), (mFace->getPool()->getShaderLevel() > 0 || LLGLSLShader::sNoFixedFunction) ? 0.f : mShiny);
+ LLGLSSpecular specular(LLColor4(1.f,1.f,1.f,1.f), 0.f);
//----------------------------------------------------------------
// setup current texture
diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp
index b626a8ebea..d37678e24f 100644
--- a/indra/newview/llviewershadermgr.cpp
+++ b/indra/newview/llviewershadermgr.cpp
@@ -471,7 +471,6 @@ void LLViewerShaderMgr::setShaders()
}
mMaxAvatarShaderLevel = 0;
- LLGLSLShader::sNoFixedFunction = false;
LLVertexBuffer::unbind();
llassert((gGLManager.mGLSLVersionMajor > 1 || gGLManager.mGLSLVersionMinor >= 10));
@@ -482,9 +481,6 @@ void LLViewerShaderMgr::setShaders()
bool doingWindLight = hasWindLightShaders && gSavedSettings.getBOOL("WindLightUseAtmosShaders");
bool useRenderDeferred = doingWindLight && canRenderDeferred && gSavedSettings.getBOOL("RenderDeferred");
- //using shaders, disable fixed function
- LLGLSLShader::sNoFixedFunction = true;
-
S32 light_class = 3;
S32 interface_class = 2;
S32 env_class = 2;
@@ -556,12 +552,12 @@ void LLViewerShaderMgr::setShaders()
}
else
{
- LL_WARNS() << "Failed to load basic shaders." << LL_ENDL;
+ LL_ERRS() << "Unable to load basic shaders, verify graphics driver installed and current." << LL_ENDL;
llassert(loaded);
+ reentrance = false; // For hygiene only, re-try probably helps nothing
+ return;
}
- if (loaded)
- {
gPipeline.mVertexShadersEnabled = TRUE;
gPipeline.mVertexShadersLoaded = 1;
@@ -686,8 +682,8 @@ void LLViewerShaderMgr::setShaders()
mShaderLevel[SHADER_AVATAR] = 0;
mShaderLevel[SHADER_DEFERRED] = 0;
- gSavedSettings.setBOOL("RenderDeferred", FALSE);
- gSavedSettings.setBOOL("RenderAvatarCloth", FALSE);
+ gSavedSettings.setBOOL("RenderDeferred", FALSE);
+ gSavedSettings.setBOOL("RenderAvatarCloth", FALSE);
loadShadersAvatar(); // unloads
@@ -718,21 +714,9 @@ void LLViewerShaderMgr::setShaders()
setShaders();
return;
}
- }
- else
- {
- LLGLSLShader::sNoFixedFunction = false;
- gPipeline.mVertexShadersEnabled = FALSE;
- gPipeline.mVertexShadersLoaded = 0;
- mShaderLevel[SHADER_LIGHTING] = 0;
- mShaderLevel[SHADER_INTERFACE] = 0;
- mShaderLevel[SHADER_ENVIRONMENT] = 0;
- mShaderLevel[SHADER_WATER] = 0;
- mShaderLevel[SHADER_OBJECT] = 0;
- mShaderLevel[SHADER_EFFECT] = 0;
- mShaderLevel[SHADER_WINDLIGHT] = 0;
- mShaderLevel[SHADER_AVATAR] = 0;
- }
+
+ // gPipeline.mVertexShadersEnabled = FALSE;
+ // gPipeline.mVertexShadersLoaded = 0;
if (gViewerWindow)
{
diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp
index 198007aaa1..10631afd13 100644
--- a/indra/newview/llviewerwindow.cpp
+++ b/indra/newview/llviewerwindow.cpp
@@ -2065,20 +2065,6 @@ void LLViewerWindow::initGLDefaults()
{
gGL.setSceneBlendType(LLRender::BT_ALPHA);
- if (!LLGLSLShader::sNoFixedFunction)
- { //initialize fixed function state
- glColorMaterial( GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE );
-
- glMaterialfv(GL_FRONT_AND_BACK,GL_AMBIENT,LLColor4::black.mV);
- glMaterialfv(GL_FRONT_AND_BACK,GL_DIFFUSE,LLColor4::white.mV);
-
- // lights for objects
- glShadeModel( GL_SMOOTH );
-
- gGL.getTexUnit(0)->enable(LLTexUnit::TT_TEXTURE);
- gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT);
- }
-
glPixelStorei(GL_PACK_ALIGNMENT,1);
glPixelStorei(GL_UNPACK_ALIGNMENT,1);
@@ -2694,10 +2680,7 @@ void LLViewerWindow::drawDebugText()
gGL.color4f(1,1,1,1);
gGL.pushMatrix();
gGL.pushUIMatrix();
- if (LLGLSLShader::sNoFixedFunction)
- {
- gUIProgram.bind();
- }
+ gUIProgram.bind();
{
// scale view by UI global scale factor and aspect ratio correction factor
gGL.scaleUI(mDisplayScale.mV[VX], mDisplayScale.mV[VY], 1.f);
@@ -2707,10 +2690,7 @@ void LLViewerWindow::drawDebugText()
gGL.popMatrix();
gGL.flush();
- if (LLGLSLShader::sNoFixedFunction)
- {
- gUIProgram.unbind();
- }
+ gUIProgram.unbind();
}
void LLViewerWindow::draw()
@@ -2756,10 +2736,7 @@ void LLViewerWindow::draw()
// Draw all nested UI views.
// No translation needed, this view is glued to 0,0
- if (LLGLSLShader::sNoFixedFunction)
- {
- gUIProgram.bind();
- }
+ gUIProgram.bind();
gGL.pushMatrix();
LLUI::pushMatrix();
@@ -2835,14 +2812,9 @@ void LLViewerWindow::draw()
LLUI::popMatrix();
gGL.popMatrix();
- if (LLGLSLShader::sNoFixedFunction)
- {
- gUIProgram.unbind();
- }
+ gUIProgram.unbind();
-//#if LL_DEBUG
LLView::sIsDrawing = FALSE;
-//#endif
}
// Takes a single keyup event, usually when UI is visible
diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp
index 84bb67a03d..da856beb6e 100644
--- a/indra/newview/llvoavatar.cpp
+++ b/indra/newview/llvoavatar.cpp
@@ -5053,11 +5053,6 @@ U32 LLVOAvatar::renderSkinned()
bool should_alpha_mask = shouldAlphaMask();
LLGLState test(GL_ALPHA_TEST, should_alpha_mask);
- if (should_alpha_mask && !LLGLSLShader::sNoFixedFunction)
- {
- gGL.setAlphaRejectSettings(LLRender::CF_GREATER, 0.5f);
- }
-
BOOL first_pass = TRUE;
if (!LLDrawPoolAvatar::sSkipOpaque)
{
@@ -5104,11 +5099,6 @@ U32 LLVOAvatar::renderSkinned()
}
}
- if (should_alpha_mask && !LLGLSLShader::sNoFixedFunction)
- {
- gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT);
- }
-
if (!LLDrawPoolAvatar::sSkipTransparent || LLPipeline::sImpostorRender)
{
LLGLState blend(GL_BLEND, !mIsDummy);
@@ -5193,11 +5183,6 @@ U32 LLVOAvatar::renderRigid()
bool should_alpha_mask = shouldAlphaMask();
LLGLState test(GL_ALPHA_TEST, should_alpha_mask);
- if (should_alpha_mask && !LLGLSLShader::sNoFixedFunction)
- {
- gGL.setAlphaRejectSettings(LLRender::CF_GREATER, 0.5f);
- }
-
if (isTextureVisible(TEX_EYES_BAKED) || (getOverallAppearance() == AOA_JELLYDOLL && !isControlAvatar()) || isUIAvatar())
{
LLViewerJoint* eyeball_left = getViewerJoint(MESH_ID_EYEBALL_LEFT);
@@ -5212,11 +5197,6 @@ U32 LLVOAvatar::renderRigid()
}
}
- if (should_alpha_mask && !LLGLSLShader::sNoFixedFunction)
- {
- gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT);
- }
-
return num_indices;
}
diff --git a/indra/newview/llvosurfacepatch.cpp b/indra/newview/llvosurfacepatch.cpp
index 4d25e8c7bd..8fbecbc7d7 100644
--- a/indra/newview/llvosurfacepatch.cpp
+++ b/indra/newview/llvosurfacepatch.cpp
@@ -59,63 +59,8 @@ public:
// virtual
void setupVertexBuffer(U32 data_mask)
{
- if (LLGLSLShader::sNoFixedFunction)
- { //just use default if shaders are in play
- LLVertexBuffer::setupVertexBuffer(data_mask & ~(MAP_TEXCOORD2 | MAP_TEXCOORD3));
- return;
- }
-
- volatile U8* base = useVBOs() ? (U8*) mAlignedOffset : mMappedData;
-
- //assume tex coords 2 and 3 are present
- U32 type_mask = mTypeMask | MAP_TEXCOORD2 | MAP_TEXCOORD3;
-
- if ((data_mask & type_mask) != data_mask)
- {
- LL_ERRS() << "LLVertexBuffer::setupVertexBuffer missing required components for supplied data mask." << LL_ENDL;
- }
-
- if (data_mask & MAP_NORMAL)
- {
- glNormalPointer(GL_FLOAT, LLVertexBuffer::sTypeSize[TYPE_NORMAL], (void*)(base + mOffsets[TYPE_NORMAL]));
- }
- if (data_mask & MAP_TEXCOORD3)
- { //substitute tex coord 1 for tex coord 3
- glClientActiveTextureARB(GL_TEXTURE3_ARB);
- glTexCoordPointer(2,GL_FLOAT, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD1], (void*)(base + mOffsets[TYPE_TEXCOORD1]));
- glClientActiveTextureARB(GL_TEXTURE0_ARB);
- }
- if (data_mask & MAP_TEXCOORD2)
- { //substitute tex coord 0 for tex coord 2
- glClientActiveTextureARB(GL_TEXTURE2_ARB);
- glTexCoordPointer(2,GL_FLOAT, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD0], (void*)(base + mOffsets[TYPE_TEXCOORD0]));
- glClientActiveTextureARB(GL_TEXTURE0_ARB);
- }
- if (data_mask & MAP_TEXCOORD1)
- {
- glClientActiveTextureARB(GL_TEXTURE1_ARB);
- glTexCoordPointer(2,GL_FLOAT, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD1], (void*)(base + mOffsets[TYPE_TEXCOORD1]));
- glClientActiveTextureARB(GL_TEXTURE0_ARB);
- }
- if (data_mask & MAP_TANGENT)
- {
- glClientActiveTextureARB(GL_TEXTURE2_ARB);
- glTexCoordPointer(3,GL_FLOAT, LLVertexBuffer::sTypeSize[TYPE_TANGENT], (void*)(base + mOffsets[TYPE_TANGENT]));
- glClientActiveTextureARB(GL_TEXTURE0_ARB);
- }
- if (data_mask & MAP_TEXCOORD0)
- {
- glTexCoordPointer(2,GL_FLOAT, LLVertexBuffer::sTypeSize[TYPE_TEXCOORD0], (void*)(base + mOffsets[TYPE_TEXCOORD0]));
- }
- if (data_mask & MAP_COLOR)
- {
- glColorPointer(4, GL_UNSIGNED_BYTE, LLVertexBuffer::sTypeSize[TYPE_COLOR], (void*)(base + mOffsets[TYPE_COLOR]));
- }
-
- if (data_mask & MAP_VERTEX)
- {
- glVertexPointer(3,GL_FLOAT, LLVertexBuffer::sTypeSize[TYPE_VERTEX], (void*)(base + 0));
- }
+ LLVertexBuffer::setupVertexBuffer(data_mask & ~(MAP_TEXCOORD2 | MAP_TEXCOORD3));
+ return;
}
};
diff --git a/indra/newview/llvowater.cpp b/indra/newview/llvowater.cpp
index efe6aa158e..089a7712c0 100644
--- a/indra/newview/llvowater.cpp
+++ b/indra/newview/llvowater.cpp
@@ -143,7 +143,7 @@ BOOL LLVOWater::updateGeometry(LLDrawable *drawable)
static const unsigned int vertices_per_quad = 4;
static const unsigned int indices_per_quad = 6;
- const S32 size = LLPipeline::sRenderTransparentWater && LLGLSLShader::sNoFixedFunction ? 16 : 1;
+ const S32 size = LLPipeline::sRenderTransparentWater ? 16 : 1;
const S32 num_quads = size * size;
face->setSize(vertices_per_quad * num_quads,
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index 1f4fdca2e7..8881b78593 100644
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -1061,7 +1061,6 @@ void LLPipeline::refreshCachedSettings()
LLPipeline::sUseOcclusion =
(!gUseWireframe
- && LLGLSLShader::sNoFixedFunction
&& LLFeatureManager::getInstance()->isFeatureAvailable("UseOcclusion")
&& gSavedSettings.getBOOL("UseOcclusion")
&& gGLManager.mHasOcclusionQuery) ? 2 : 0;
@@ -2338,8 +2337,7 @@ static LLTrace::BlockTimerStatHandle FTM_CULL("Object Culling");
void LLPipeline::updateCull(LLCamera& camera, LLCullResult& result, S32 water_clip, LLPlane* planep)
{
static LLCachedControl<bool> use_occlusion(gSavedSettings,"UseOcclusion");
- static bool can_use_occlusion = LLGLSLShader::sNoFixedFunction
- && LLFeatureManager::getInstance()->isFeatureAvailable("UseOcclusion")
+ static bool can_use_occlusion = LLFeatureManager::getInstance()->isFeatureAvailable("UseOcclusion")
&& gGLManager.mHasOcclusionQuery;
LL_RECORD_BLOCK_TIME(FTM_CULL);
@@ -2650,7 +2648,7 @@ void LLPipeline::doOcclusion(LLCamera& camera)
LLGLDisable cull(GL_CULL_FACE);
- bool bind_shader = LLGLSLShader::sNoFixedFunction && LLGLSLShader::sCurBoundShader == 0;
+ bool bind_shader = (LLGLSLShader::sCurBoundShader == 0);
if (bind_shader)
{
if (LLPipeline::sShadowRender)
@@ -3992,10 +3990,7 @@ void render_hud_elements()
gGL.color4f(1,1,1,1);
- if (LLGLSLShader::sNoFixedFunction)
- {
- gUIProgram.bind();
- }
+ gUIProgram.bind();
LLGLDepthTest depth(GL_TRUE, GL_FALSE);
if (!LLPipeline::sReflectionRender && gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_UI))
@@ -4027,10 +4022,7 @@ void render_hud_elements()
LLHUDText::renderAllHUD();
}
- if (LLGLSLShader::sNoFixedFunction)
- {
- gUIProgram.unbind();
- }
+ gUIProgram.unbind();
gGL.flush();
}
@@ -4062,10 +4054,7 @@ void LLPipeline::renderHighlights()
gGL.setColorMask(false, false);
- if (LLGLSLShader::sNoFixedFunction)
- {
- gHighlightProgram.bind();
- }
+ gHighlightProgram.bind();
for (std::set<HighlightItem>::iterator iter = mHighlightSet.begin(); iter != mHighlightSet.end(); ++iter)
{
@@ -4297,7 +4286,6 @@ void LLPipeline::renderGeom(LLCamera& camera, bool forceVBOUpdate)
// Do verification of GL state
LLGLState::checkStates();
LLGLState::checkTextureChannels();
- LLGLState::checkClientArrays();
if (mRenderDebugMask & RENDER_DEBUG_VERIFY)
{
if (!verify())
@@ -4546,7 +4534,6 @@ void LLPipeline::renderGeomDeferred(LLCamera& camera)
LLGLState::checkStates();
LLGLState::checkTextureChannels();
- LLGLState::checkClientArrays();
U32 cur_type = 0;
@@ -4819,10 +4806,7 @@ void LLPipeline::renderPhysicsDisplay()
gGL.setColorMask(true, false);
- if (LLGLSLShader::sNoFixedFunction)
- {
- gDebugProgram.bind();
- }
+ gDebugProgram.bind();
for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin();
iter != LLWorld::getInstance()->getRegionList().end(); ++iter)
@@ -4843,11 +4827,7 @@ void LLPipeline::renderPhysicsDisplay()
gGL.flush();
- if (LLGLSLShader::sNoFixedFunction)
- {
- gDebugProgram.unbind();
- }
-
+ gDebugProgram.unbind();
mPhysicsDisplay.flush();
}
@@ -4874,13 +4854,10 @@ void LLPipeline::renderDebug()
if ( pathfindingCharacter->getVisible() || gAgentCamera.cameraMouselook() )
{
- if (LLGLSLShader::sNoFixedFunction)
- {
- gPathfindingProgram.bind();
- gPathfindingProgram.uniform1f(sTint, 1.f);
- gPathfindingProgram.uniform1f(sAmbiance, 1.f);
- gPathfindingProgram.uniform1f(sAlphaScale, 1.f);
- }
+ gPathfindingProgram.bind();
+ gPathfindingProgram.uniform1f(sTint, 1.f);
+ gPathfindingProgram.uniform1f(sAmbiance, 1.f);
+ gPathfindingProgram.uniform1f(sAlphaScale, 1.f);
//Requried character physics capsule render parameters
LLUUID id;
@@ -4889,21 +4866,14 @@ void LLPipeline::renderDebug()
if ( pathfindingCharacter->isPhysicsCapsuleEnabled( id, pos, rot ) )
{
- if (LLGLSLShader::sNoFixedFunction)
- {
- //remove blending artifacts
- gGL.setColorMask(false, false);
- llPathingLibInstance->renderSimpleShapeCapsuleID( gGL, id, pos, rot );
- gGL.setColorMask(true, false);
- LLGLEnable blend(GL_BLEND);
- gPathfindingProgram.uniform1f(sAlphaScale, 0.90f);
- llPathingLibInstance->renderSimpleShapeCapsuleID( gGL, id, pos, rot );
- gPathfindingProgram.bind();
- }
- else
- {
- llPathingLibInstance->renderSimpleShapeCapsuleID( gGL, id, pos, rot );
- }
+ //remove blending artifacts
+ gGL.setColorMask(false, false);
+ llPathingLibInstance->renderSimpleShapeCapsuleID( gGL, id, pos, rot );
+ gGL.setColorMask(true, false);
+ LLGLEnable blend(GL_BLEND);
+ gPathfindingProgram.uniform1f(sAlphaScale, 0.90f);
+ llPathingLibInstance->renderSimpleShapeCapsuleID( gGL, id, pos, rot );
+ gPathfindingProgram.bind();
}
}
}
@@ -4919,14 +4889,11 @@ void LLPipeline::renderDebug()
{
F32 ambiance = gSavedSettings.getF32("PathfindingAmbiance");
- if (LLGLSLShader::sNoFixedFunction)
- {
- gPathfindingProgram.bind();
+ gPathfindingProgram.bind();
- gPathfindingProgram.uniform1f(sTint, 1.f);
- gPathfindingProgram.uniform1f(sAmbiance, ambiance);
- gPathfindingProgram.uniform1f(sAlphaScale, 1.f);
- }
+ gPathfindingProgram.uniform1f(sTint, 1.f);
+ gPathfindingProgram.uniform1f(sAmbiance, ambiance);
+ gPathfindingProgram.uniform1f(sAlphaScale, 1.f);
if ( !pathfindingConsole->isRenderWorld() )
{
@@ -4958,18 +4925,11 @@ void LLPipeline::renderDebug()
}
//render edges
- if (LLGLSLShader::sNoFixedFunction)
- {
- gPathfindingNoNormalsProgram.bind();
- gPathfindingNoNormalsProgram.uniform1f(sTint, 1.f);
- gPathfindingNoNormalsProgram.uniform1f(sAlphaScale, 1.f);
- llPathingLibInstance->renderNavMeshEdges();
- gPathfindingProgram.bind();
- }
- else
- {
- llPathingLibInstance->renderNavMeshEdges();
- }
+ gPathfindingNoNormalsProgram.bind();
+ gPathfindingNoNormalsProgram.uniform1f(sTint, 1.f);
+ gPathfindingNoNormalsProgram.uniform1f(sAlphaScale, 1.f);
+ llPathingLibInstance->renderNavMeshEdges();
+ gPathfindingProgram.bind();
gGL.flush();
glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );
@@ -4980,53 +4940,31 @@ void LLPipeline::renderDebug()
if ( LLPathfindingPathTool::getInstance()->isRenderPath() )
{
//The path
- if (LLGLSLShader::sNoFixedFunction)
- {
- gUIProgram.bind();
- gGL.getTexUnit(0)->bind(LLViewerFetchedTexture::sWhiteImagep);
- llPathingLibInstance->renderPath();
- gPathfindingProgram.bind();
- }
- else
- {
- llPathingLibInstance->renderPath();
- }
- //The bookends
- if (LLGLSLShader::sNoFixedFunction)
- {
- //remove blending artifacts
- gGL.setColorMask(false, false);
- llPathingLibInstance->renderPathBookend( gGL, LLPathingLib::LLPL_START );
- llPathingLibInstance->renderPathBookend( gGL, LLPathingLib::LLPL_END );
+ gUIProgram.bind();
+ gGL.getTexUnit(0)->bind(LLViewerFetchedTexture::sWhiteImagep);
+ llPathingLibInstance->renderPath();
+ gPathfindingProgram.bind();
+
+ //The bookends
+ //remove blending artifacts
+ gGL.setColorMask(false, false);
+ llPathingLibInstance->renderPathBookend( gGL, LLPathingLib::LLPL_START );
+ llPathingLibInstance->renderPathBookend( gGL, LLPathingLib::LLPL_END );
- gGL.setColorMask(true, false);
- //render the bookends
- LLGLEnable blend(GL_BLEND);
- gPathfindingProgram.uniform1f(sAlphaScale, 0.90f);
- llPathingLibInstance->renderPathBookend( gGL, LLPathingLib::LLPL_START );
- llPathingLibInstance->renderPathBookend( gGL, LLPathingLib::LLPL_END );
- gPathfindingProgram.bind();
- }
- else
- {
- llPathingLibInstance->renderPathBookend( gGL, LLPathingLib::LLPL_START );
- llPathingLibInstance->renderPathBookend( gGL, LLPathingLib::LLPL_END );
- }
-
+ gGL.setColorMask(true, false);
+ //render the bookends
+ LLGLEnable blend(GL_BLEND);
+ gPathfindingProgram.uniform1f(sAlphaScale, 0.90f);
+ llPathingLibInstance->renderPathBookend( gGL, LLPathingLib::LLPL_START );
+ llPathingLibInstance->renderPathBookend( gGL, LLPathingLib::LLPL_END );
+ gPathfindingProgram.bind();
}
if ( pathfindingConsole->isRenderWaterPlane() )
{
- if (LLGLSLShader::sNoFixedFunction)
- {
- LLGLEnable blend(GL_BLEND);
- gPathfindingProgram.uniform1f(sAlphaScale, 0.90f);
- llPathingLibInstance->renderSimpleShapes( gGL, gAgent.getRegion()->getWaterHeight() );
- }
- else
- {
- llPathingLibInstance->renderSimpleShapes( gGL, gAgent.getRegion()->getWaterHeight() );
- }
+ LLGLEnable blend(GL_BLEND);
+ gPathfindingProgram.uniform1f(sAlphaScale, 0.90f);
+ llPathingLibInstance->renderSimpleShapes( gGL, gAgent.getRegion()->getWaterHeight() );
}
//physics/exclusion shapes
if ( pathfindingConsole->isRenderAnyShapes() )
@@ -5157,18 +5095,11 @@ void LLPipeline::renderDebug()
}
//render edges
- if (LLGLSLShader::sNoFixedFunction)
- {
- gPathfindingNoNormalsProgram.bind();
- gPathfindingNoNormalsProgram.uniform1f(sTint, gSavedSettings.getF32("PathfindingXRayTint"));
- gPathfindingNoNormalsProgram.uniform1f(sAlphaScale, gSavedSettings.getF32("PathfindingXRayOpacity"));
- llPathingLibInstance->renderNavMeshEdges();
- gPathfindingProgram.bind();
- }
- else
- {
- llPathingLibInstance->renderNavMeshEdges();
- }
+ gPathfindingNoNormalsProgram.bind();
+ gPathfindingNoNormalsProgram.uniform1f(sTint, gSavedSettings.getF32("PathfindingXRayTint"));
+ gPathfindingNoNormalsProgram.uniform1f(sAlphaScale, gSavedSettings.getF32("PathfindingXRayOpacity"));
+ llPathingLibInstance->renderNavMeshEdges();
+ gPathfindingProgram.bind();
gGL.flush();
glLineWidth(1.0f);
@@ -5177,10 +5108,7 @@ void LLPipeline::renderDebug()
glPolygonOffset(0.f, 0.f);
gGL.flush();
- if (LLGLSLShader::sNoFixedFunction)
- {
- gPathfindingProgram.unbind();
- }
+ gPathfindingProgram.unbind();
}
}
}
@@ -5195,10 +5123,7 @@ void LLPipeline::renderDebug()
if (!hud_only && !mDebugBlips.empty())
{ //render debug blips
- if (LLGLSLShader::sNoFixedFunction)
- {
- gUIProgram.bind();
- }
+ gUIProgram.bind();
gGL.getTexUnit(0)->bind(LLViewerFetchedTexture::sWhiteImagep, true);
@@ -5262,7 +5187,7 @@ void LLPipeline::renderDebug()
}
}
- if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_OCCLUSION) && LLGLSLShader::sNoFixedFunction)
+ if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_OCCLUSION))
{ //render visible selected group occlusion geometry
gDebugProgram.bind();
LLGLDepthTest depth(GL_TRUE, GL_FALSE);
@@ -5284,44 +5209,38 @@ void LLPipeline::renderDebug()
visible_selected_groups.clear();
- if (LLGLSLShader::sNoFixedFunction)
- {
- gUIProgram.bind();
- }
+ gUIProgram.bind();
if (hasRenderDebugMask(LLPipeline::RENDER_DEBUG_RAYCAST) && !hud_only)
{ //draw crosshairs on particle intersection
if (gDebugRaycastParticle)
{
- if (LLGLSLShader::sNoFixedFunction)
- { //this debug display requires shaders
- gDebugProgram.bind();
+ gDebugProgram.bind();
- gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
+ gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
- LLVector3 center(gDebugRaycastParticleIntersection.getF32ptr());
- LLVector3 size(0.1f, 0.1f, 0.1f);
+ LLVector3 center(gDebugRaycastParticleIntersection.getF32ptr());
+ LLVector3 size(0.1f, 0.1f, 0.1f);
- LLVector3 p[6];
+ LLVector3 p[6];
- p[0] = center + size.scaledVec(LLVector3(1,0,0));
- p[1] = center + size.scaledVec(LLVector3(-1,0,0));
- p[2] = center + size.scaledVec(LLVector3(0,1,0));
- p[3] = center + size.scaledVec(LLVector3(0,-1,0));
- p[4] = center + size.scaledVec(LLVector3(0,0,1));
- p[5] = center + size.scaledVec(LLVector3(0,0,-1));
+ p[0] = center + size.scaledVec(LLVector3(1,0,0));
+ p[1] = center + size.scaledVec(LLVector3(-1,0,0));
+ p[2] = center + size.scaledVec(LLVector3(0,1,0));
+ p[3] = center + size.scaledVec(LLVector3(0,-1,0));
+ p[4] = center + size.scaledVec(LLVector3(0,0,1));
+ p[5] = center + size.scaledVec(LLVector3(0,0,-1));
- gGL.begin(LLRender::LINES);
- gGL.diffuseColor3f(1.f, 1.f, 0.f);
- for (U32 i = 0; i < 6; i++)
- {
- gGL.vertex3fv(p[i].mV);
- }
- gGL.end();
- gGL.flush();
-
- gDebugProgram.unbind();
+ gGL.begin(LLRender::LINES);
+ gGL.diffuseColor3f(1.f, 1.f, 0.f);
+ for (U32 i = 0; i < 6; i++)
+ {
+ gGL.vertex3fv(p[i].mV);
}
+ gGL.end();
+ gGL.flush();
+
+ gDebugProgram.unbind();
}
}
@@ -5554,10 +5473,7 @@ void LLPipeline::renderDebug()
}
gGL.flush();
- if (LLGLSLShader::sNoFixedFunction)
- {
- gUIProgram.unbind();
- }
+ gUIProgram.unbind();
}
void LLPipeline::rebuildPools()
@@ -6226,11 +6142,6 @@ void LLPipeline::setupHWLights(LLDrawPool* pool)
LLEnvironment& environment = LLEnvironment::instance();
LLSettingsSky::ptr_t psky = environment.getCurrentSky();
- if (!LLGLSLShader::sNoFixedFunction)
- {
- gGL.syncMatrices();
- }
-
// Ambient
LLColor4 ambient = psky->getTotalAmbient();
gGL.setAmbientLightColor(ambient);
@@ -6429,11 +6340,6 @@ void LLPipeline::setupHWLights(LLDrawPool* pool)
// prev site of forward (non-deferred) character light injection, removed by SL-13522 09/20
// Init GL state
- if (!LLGLSLShader::sNoFixedFunction)
- {
- glDisable(GL_LIGHTING);
- }
-
for (S32 i = 0; i < 8; ++i)
{
gGL.getLight(i)->disable();
@@ -6452,13 +6358,6 @@ void LLPipeline::enableLights(U32 mask)
if (mLightMask != mask)
{
stop_glerror();
- if (!mLightMask)
- {
- if (!LLGLSLShader::sNoFixedFunction)
- {
- glEnable(GL_LIGHTING);
- }
- }
if (mask)
{
stop_glerror();
@@ -6478,13 +6377,6 @@ void LLPipeline::enableLights(U32 mask)
}
stop_glerror();
}
- else
- {
- if (!LLGLSLShader::sNoFixedFunction)
- {
- glDisable(GL_LIGHTING);
- }
- }
mLightMask = mask;
stop_glerror();
}
@@ -6535,11 +6427,6 @@ void LLPipeline::enableLightsPreview()
{
disableLights();
- if (!LLGLSLShader::sNoFixedFunction)
- {
- glEnable(GL_LIGHTING);
- }
-
LLColor4 ambient = PreviewAmbientColor;
gGL.setAmbientLightColor(ambient);
@@ -8093,18 +7980,7 @@ void LLPipeline::renderFinalize()
LLGLDisable blend(GL_BLEND);
- if (LLGLSLShader::sNoFixedFunction)
- {
- gGlowCombineProgram.bind();
- }
- else
- {
- // tex unit 0
- gGL.getTexUnit(0)->setTextureColorBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_TEX_COLOR);
- // tex unit 1
- gGL.getTexUnit(1)->setTextureColorBlend(LLTexUnit::TBO_ADD, LLTexUnit::TBS_TEX_COLOR,
- LLTexUnit::TBS_PREV_COLOR);
- }
+ gGlowCombineProgram.bind();
gGL.getTexUnit(0)->bind(&mGlow[1]);
gGL.getTexUnit(1)->bind(&mScreen);
@@ -8114,28 +7990,14 @@ void LLPipeline::renderFinalize()
buff->setBuffer(mask);
buff->drawArrays(LLRender::TRIANGLE_STRIP, 0, 3);
- if (LLGLSLShader::sNoFixedFunction)
- {
- gGlowCombineProgram.unbind();
- }
- else
- {
- gGL.getTexUnit(1)->disable();
- gGL.getTexUnit(1)->setTextureBlendType(LLTexUnit::TB_MULT);
-
- gGL.getTexUnit(0)->activate();
- gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT);
- }
+ gGlowCombineProgram.unbind();
}
gGL.setSceneBlendType(LLRender::BT_ALPHA);
if (hasRenderDebugMask(LLPipeline::RENDER_DEBUG_PHYSICS_SHAPES))
{
- if (LLGLSLShader::sNoFixedFunction)
- {
- gSplatTextureRectProgram.bind();
- }
+ gSplatTextureRectProgram.bind();
gGL.setColorMask(true, false);
@@ -8161,10 +8023,7 @@ void LLPipeline::renderFinalize()
gGL.end();
gGL.flush();
- if (LLGLSLShader::sNoFixedFunction)
- {
- gSplatTextureRectProgram.unbind();
- }
+ gSplatTextureRectProgram.unbind();
}
if (LLRenderTarget::sUseFBO)
@@ -9502,17 +9361,11 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in)
renderGeom(camera);
}
- if (LLGLSLShader::sNoFixedFunction)
- {
- gUIProgram.bind();
- }
+ gUIProgram.bind();
LLWorld::getInstance()->renderPropertyLines();
- if (LLGLSLShader::sNoFixedFunction)
- {
- gUIProgram.unbind();
- }
+ gUIProgram.unbind();
mWaterDis.flush();
}
@@ -10066,10 +9919,7 @@ void LLPipeline::generateHighlight(LLCamera& camera)
gGL.setColorMask(true, true);
mHighlight.clear();
- if (LLGLSLShader::sNoFixedFunction)
- {
- gHighlightProgram.bind();
- }
+ gHighlightProgram.bind();
gGL.getTexUnit(0)->bind(LLViewerFetchedTexture::sWhiteImagep);
for (std::set<HighlightItem>::iterator iter = mHighlightSet.begin(); iter != mHighlightSet.end(); )
@@ -10951,7 +10801,6 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar)
LL_RECORD_BLOCK_TIME(FTM_GENERATE_IMPOSTOR);
LLGLState::checkStates();
LLGLState::checkTextureChannels();
- LLGLState::checkClientArrays();
static LLCullResult result;
result.clear();
@@ -11210,11 +11059,7 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar)
static const F32 clip_plane = 0.99999f;
- if (LLGLSLShader::sNoFixedFunction)
- {
- gDebugProgram.bind();
- }
-
+ gDebugProgram.bind();
if (visually_muted)
{ // Visually muted avatar
@@ -11228,7 +11073,6 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar)
gGL.diffuseColor4fv(LLColor4::pink.mV );
}
- {
gGL.begin(LLRender::QUADS);
gGL.vertex3f(-1, -1, clip_plane);
gGL.vertex3f(1, -1, clip_plane);
@@ -11236,12 +11080,8 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar)
gGL.vertex3f(-1, 1, clip_plane);
gGL.end();
gGL.flush();
- }
- if (LLGLSLShader::sNoFixedFunction)
- {
- gDebugProgram.unbind();
- }
+ gDebugProgram.unbind();
gGL.popMatrix();
gGL.matrixMode(LLRender::MM_MODELVIEW);
@@ -11270,7 +11110,6 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar)
LLVertexBuffer::unbind();
LLGLState::checkStates();
LLGLState::checkTextureChannels();
- LLGLState::checkClientArrays();
}
bool LLPipeline::hasRenderBatches(const U32 type) const