From 68e09edad0d863d57ba06e2842b9399f3ff21618 Mon Sep 17 00:00:00 2001 From: Dave Houlton Date: Mon, 29 Nov 2021 17:07:25 -0700 Subject: SL-16386 remove references to (const true) LLGLSLShader::sNoFixedFunction --- indra/llappearance/lltexlayer.cpp | 115 ++------- indra/llrender/llcubemap.cpp | 34 --- indra/llrender/llgl.cpp | 221 ++--------------- indra/llrender/llgl.h | 1 - indra/llrender/llglslshader.cpp | 1 - indra/llrender/llglslshader.h | 1 - indra/llrender/llrender.cpp | 416 ++------------------------------ indra/llrender/llrender.h | 5 +- indra/llrender/llrender2dutils.cpp | 80 +----- indra/llrender/llshadermgr.cpp | 38 --- indra/llrender/llvertexbuffer.cpp | 353 ++++++++------------------- indra/llwindow/llwindowwin32.cpp | 8 - indra/newview/lldrawpoolavatar.cpp | 17 +- indra/newview/lldrawpoolbump.cpp | 18 +- indra/newview/lldrawpoolsky.cpp | 12 +- indra/newview/lldrawpoolterrain.cpp | 21 +- indra/newview/lldrawpooltree.cpp | 2 +- indra/newview/lldrawpoolwater.cpp | 19 +- indra/newview/lldrawpoolwlsky.cpp | 25 +- indra/newview/llfloaterbvhpreview.cpp | 5 +- indra/newview/llfloaterimagepreview.cpp | 20 +- indra/newview/llglsandbox.cpp | 10 +- indra/newview/llhudtext.cpp | 2 - indra/newview/lllegacyatmospherics.cpp | 31 --- indra/newview/llmaniprotate.cpp | 21 +- indra/newview/llmaniptranslate.cpp | 7 +- indra/newview/llmodelpreview.cpp | 23 +- indra/newview/llscenemonitor.cpp | 9 +- indra/newview/llspatialpartition.cpp | 14 +- indra/newview/lltoolmorph.cpp | 5 +- indra/newview/llviewercontrol.cpp | 2 +- indra/newview/llviewerdisplay.cpp | 30 +-- indra/newview/llviewerjointmesh.cpp | 4 +- indra/newview/llviewershadermgr.cpp | 32 +-- indra/newview/llviewerwindow.cpp | 36 +-- indra/newview/llvoavatar.cpp | 20 -- indra/newview/llvosurfacepatch.cpp | 59 +---- indra/newview/llvowater.cpp | 2 +- indra/newview/pipeline.cpp | 335 +++++++------------------ 39 files changed, 320 insertions(+), 1734 deletions(-) (limited to 'indra') 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 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::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 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 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& 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 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 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::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::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 -- cgit v1.2.3 From 5fcea00c4f88561021fa2ab4ee8d72fff2b5ff83 Mon Sep 17 00:00:00 2001 From: Dave Houlton Date: Tue, 30 Nov 2021 11:19:41 -0700 Subject: SL-16386 purge no-op fxn LLTexUnit::setTextureBlendType() --- indra/llappearance/lltexlayer.cpp | 3 --- indra/llrender/llrender.cpp | 9 --------- indra/llrender/llrender.h | 2 -- indra/newview/lldrawpoolbump.cpp | 12 ------------ indra/newview/lldrawpoolterrain.cpp | 4 ---- indra/newview/lldrawpoolwater.cpp | 7 ------- indra/newview/llhudnametag.cpp | 2 -- indra/newview/llhudtext.cpp | 3 --- indra/newview/llviewerdisplay.cpp | 3 --- indra/newview/llviewerjointmesh.cpp | 5 ----- 10 files changed, 50 deletions(-) (limited to 'indra') diff --git a/indra/llappearance/lltexlayer.cpp b/indra/llappearance/lltexlayer.cpp index 9af59c7da4..de10560b22 100644 --- a/indra/llappearance/lltexlayer.cpp +++ b/indra/llappearance/lltexlayer.cpp @@ -529,7 +529,6 @@ void LLTexLayerSet::renderAlphaMaskTextures(S32 x, S32 y, S32 width, S32 height, { LLGLSUIDefault gls_ui; gGL.getTexUnit(0)->bind(tex); - gGL.getTexUnit(0)->setTextureBlendType( LLTexUnit::TB_REPLACE ); gl_rect_2d_simple_tex( width, height ); } } @@ -555,7 +554,6 @@ void LLTexLayerSet::renderAlphaMaskTextures(S32 x, S32 y, S32 width, S32 height, if (mMaskLayerList.size() > 0) { gGL.setSceneBlendType(LLRender::BT_MULT_ALPHA); - gGL.getTexUnit(0)->setTextureBlendType( LLTexUnit::TB_REPLACE ); for (layer_list_t::iterator iter = mMaskLayerList.begin(); iter != mMaskLayerList.end(); iter++) { LLTexLayerInterface* layer = *iter; @@ -568,7 +566,6 @@ void LLTexLayerSet::renderAlphaMaskTextures(S32 x, S32 y, S32 width, S32 height, gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT); gGL.setColorMask(true, true); gGL.setSceneBlendType(LLRender::BT_ALPHA); } diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp index 899c61ccb7..14abd9b83e 100644 --- a/indra/llrender/llrender.cpp +++ b/indra/llrender/llrender.cpp @@ -137,11 +137,6 @@ void LLTexUnit::refreshState(void) glBindTexture(GL_TEXTURE_2D, 0); } - if (mCurrBlendType != TB_COMBINE) - { - setTextureBlendType(mCurrBlendType); - } - setTextureColorSpace(mTexColorSpace); } @@ -540,10 +535,6 @@ void LLTexUnit::setTextureFilteringOption(LLTexUnit::eTextureFilterOptions optio } } -void LLTexUnit::setTextureBlendType(eTextureBlendType type) -{ -} - GLint LLTexUnit::getTextureSource(eTextureBlendSrc src) { switch(src) diff --git a/indra/llrender/llrender.h b/indra/llrender/llrender.h index 42aca6e665..2feb8f955b 100644 --- a/indra/llrender/llrender.h +++ b/indra/llrender/llrender.h @@ -201,8 +201,6 @@ public: // make sure you want to permanently change the filtering for the bound texture. void setTextureFilteringOption(LLTexUnit::eTextureFilterOptions option); - void setTextureBlendType(eTextureBlendType type); - inline void setTextureColorBlend(eTextureBlendOp op, eTextureBlendSrc src1, eTextureBlendSrc src2 = TBS_PREV_COLOR) { /* setTextureCombiner(op, src1, src2, false); */ } diff --git a/indra/newview/lldrawpoolbump.cpp b/indra/newview/lldrawpoolbump.cpp index 2d26ee9f65..3b039cd505 100644 --- a/indra/newview/lldrawpoolbump.cpp +++ b/indra/newview/lldrawpoolbump.cpp @@ -593,21 +593,9 @@ void LLDrawPoolBump::endFullbrightShiny() if( cube_map ) { cube_map->disable(); - - /*if (diffuse_channel != 0) - { - shader->disableTexture(LLViewerShaderMgr::DIFFUSE_MAP); - } - gGL.getTexUnit(0)->activate(); - gGL.getTexUnit(0)->enable(LLTexUnit::TT_TEXTURE);*/ - shader->unbind(); - //gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT); } - //gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - //gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT); - diffuse_channel = -1; cube_channel = 0; mShiny = FALSE; diff --git a/indra/newview/lldrawpoolterrain.cpp b/indra/newview/lldrawpoolterrain.cpp index c71ebaffb9..cc21f13678 100644 --- a/indra/newview/lldrawpoolterrain.cpp +++ b/indra/newview/lldrawpoolterrain.cpp @@ -627,8 +627,6 @@ void LLDrawPoolTerrain::renderFull4TU() gGL.matrixMode(LLRender::MM_TEXTURE); gGL.loadIdentity(); gGL.matrixMode(LLRender::MM_MODELVIEW); - - gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT); } void LLDrawPoolTerrain::renderFull2TU() @@ -814,7 +812,6 @@ void LLDrawPoolTerrain::renderFull2TU() gGL.matrixMode(LLRender::MM_TEXTURE); gGL.loadIdentity(); gGL.matrixMode(LLRender::MM_MODELVIEW); - gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT); } @@ -852,7 +849,6 @@ void LLDrawPoolTerrain::renderSimple() gGL.matrixMode(LLRender::MM_TEXTURE); gGL.loadIdentity(); gGL.matrixMode(LLRender::MM_MODELVIEW); - gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT); } //============================================================================ diff --git a/indra/newview/lldrawpoolwater.cpp b/indra/newview/lldrawpoolwater.cpp index c0e82ead43..4023d59776 100644 --- a/indra/newview/lldrawpoolwater.cpp +++ b/indra/newview/lldrawpoolwater.cpp @@ -299,8 +299,6 @@ void LLDrawPoolWater::render(S32 pass) gGL.matrixMode(LLRender::MM_MODELVIEW); LLOverrideFaceColor overrid(this, 1.f, 1.f, 1.f, 0.5f*up_dot); - gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT); - for (std::vector::iterator iter = mDrawFace.begin(); iter != mDrawFace.end(); iter++) { @@ -317,8 +315,6 @@ void LLDrawPoolWater::render(S32 pass) } } - gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT); - gSky.mVOSkyp->getCubeMap()->disable(); gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); @@ -336,8 +332,6 @@ void LLDrawPoolWater::render(S32 pass) glStencilFunc(GL_NOTEQUAL, 0, 0xFFFFFFFF); renderReflection(refl_face); } - - gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT); } // for low end hardware @@ -447,7 +441,6 @@ void LLDrawPoolWater::renderOpaqueLegacyWater() } gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT); } diff --git a/indra/newview/llhudnametag.cpp b/indra/newview/llhudnametag.cpp index 55a4b5a457..8e296321d2 100644 --- a/indra/newview/llhudnametag.cpp +++ b/indra/newview/llhudnametag.cpp @@ -323,8 +323,6 @@ void LLHUDNameTag::renderText(BOOL for_select) // Render label { - //gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT); - for(std::vector::iterator segment_iter = mLabelSegments.begin(); segment_iter != mLabelSegments.end(); ++segment_iter ) { diff --git a/indra/newview/llhudtext.cpp b/indra/newview/llhudtext.cpp index d01d25a75b..9d8bf7f51c 100644 --- a/indra/newview/llhudtext.cpp +++ b/indra/newview/llhudtext.cpp @@ -188,9 +188,6 @@ void LLHUDText::renderText() F32 y_offset = (F32)mOffsetY; // Render label - { - gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT); - } // Render text { diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp index 60ba07d3af..046187cf4f 100644 --- a/indra/newview/llviewerdisplay.cpp +++ b/indra/newview/llviewerdisplay.cpp @@ -166,8 +166,6 @@ void display_startup() if (gViewerWindow) gViewerWindow->setup2DRender(); - gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT); - gGL.color4f(1,1,1,1); if (gViewerWindow) gViewerWindow->draw(); @@ -1480,7 +1478,6 @@ void render_ui_2d() } stop_glerror(); - //gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT); // render outline for HUD if (isAgentAvatarValid() && gAgentCamera.mHUDCurZoom < 0.98f) diff --git a/indra/newview/llviewerjointmesh.cpp b/indra/newview/llviewerjointmesh.cpp index 98d8f91116..640e54c2e1 100644 --- a/indra/newview/llviewerjointmesh.cpp +++ b/indra/newview/llviewerjointmesh.cpp @@ -328,11 +328,6 @@ U32 LLViewerJointMesh::drawShape( F32 pixelArea, BOOL first_pass, BOOL is_dummy) triangle_count += count; - if (mTestImageName) - { - gGL.getTexUnit(diffuse_channel)->setTextureBlendType(LLTexUnit::TB_MULT); - } - return triangle_count; } -- cgit v1.2.3 From 3d1901dd4c6e549ec78bef6cea8682d12946c063 Mon Sep 17 00:00:00 2001 From: Dave Houlton Date: Tue, 30 Nov 2021 11:42:37 -0700 Subject: SL-16386 purge no-op fxn LLTexUnit::setTextureColorBlend() --- indra/llrender/llrender.h | 8 +------- indra/newview/lldrawpoolbump.cpp | 1 - indra/newview/lldrawpoolterrain.cpp | 24 ------------------------ indra/newview/lldrawpoolwater.cpp | 1 - indra/newview/llviewerjointmesh.cpp | 1 - 5 files changed, 1 insertion(+), 34 deletions(-) (limited to 'indra') diff --git a/indra/llrender/llrender.h b/indra/llrender/llrender.h index 2feb8f955b..08a906a89b 100644 --- a/indra/llrender/llrender.h +++ b/indra/llrender/llrender.h @@ -105,10 +105,7 @@ public: TBO_LERP_VERT_ALPHA, // Interpolate based on Vertex Alpha (VA): ( Source1 * VA + Source2 * (1-VA) ) TBO_LERP_TEX_ALPHA, // Interpolate based on Texture Alpha (TA): ( Source1 * TA + Source2 * (1-TA) ) TBO_LERP_PREV_ALPHA, // Interpolate based on Previous Alpha (PA): ( Source1 * PA + Source2 * (1-PA) ) - TBO_LERP_CONST_ALPHA, // Interpolate based on Const Alpha (CA): ( Source1 * CA + Source2 * (1-CA) ) - TBO_LERP_VERT_COLOR // Interpolate based on Vertex Col (VC): ( Source1 * VC + Source2 * (1-VC) ) - // *Note* TBO_LERP_VERTEX_COLOR only works with setTextureColorBlend(), - // and falls back to TBO_LERP_VERTEX_ALPHA for setTextureAlphaBlend(). + TBO_LERP_CONST_ALPHA // Interpolate based on Const Alpha (CA): ( Source1 * CA + Source2 * (1-CA) ) } eTextureBlendOp; typedef enum @@ -201,9 +198,6 @@ public: // make sure you want to permanently change the filtering for the bound texture. void setTextureFilteringOption(LLTexUnit::eTextureFilterOptions option); - inline void setTextureColorBlend(eTextureBlendOp op, eTextureBlendSrc src1, eTextureBlendSrc src2 = TBS_PREV_COLOR) - { /* 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); */ } diff --git a/indra/newview/lldrawpoolbump.cpp b/indra/newview/lldrawpoolbump.cpp index 3b039cd505..6fd6fc06c6 100644 --- a/indra/newview/lldrawpoolbump.cpp +++ b/indra/newview/lldrawpoolbump.cpp @@ -403,7 +403,6 @@ void LLDrawPoolBump::bindCubeMap(LLGLSLShader* shader, S32 shader_level, S32& di cube_map->enable(0); gGL.getTexUnit(0)->bind(cube_map); - gGL.getTexUnit(0)->setTextureColorBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_TEX_COLOR); gGL.getTexUnit(0)->setTextureAlphaBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_VERT_ALPHA); } } diff --git a/indra/newview/lldrawpoolterrain.cpp b/indra/newview/lldrawpoolterrain.cpp index cc21f13678..5db816d003 100644 --- a/indra/newview/lldrawpoolterrain.cpp +++ b/indra/newview/lldrawpoolterrain.cpp @@ -467,8 +467,6 @@ void LLDrawPoolTerrain::renderFull4TU() glTexGenfv(GL_S, GL_OBJECT_PLANE, tp0.mV); glTexGenfv(GL_T, GL_OBJECT_PLANE, tp1.mV); - gGL.getTexUnit(0)->setTextureColorBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_TEX_COLOR); - // // Stage 1: Generate alpha ramp for detail0/detail1 transition // @@ -478,7 +476,6 @@ void LLDrawPoolTerrain::renderFull4TU() gGL.getTexUnit(1)->activate(); // Care about alpha only - gGL.getTexUnit(1)->setTextureColorBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_PREV_COLOR); gGL.getTexUnit(1)->setTextureAlphaBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_TEX_ALPHA); // @@ -495,8 +492,6 @@ void LLDrawPoolTerrain::renderFull4TU() glTexGenfv(GL_S, GL_OBJECT_PLANE, tp0.mV); glTexGenfv(GL_T, GL_OBJECT_PLANE, tp1.mV); - gGL.getTexUnit(2)->setTextureColorBlend(LLTexUnit::TBO_LERP_PREV_ALPHA, LLTexUnit::TBS_PREV_COLOR, LLTexUnit::TBS_TEX_COLOR); - // // Stage 3: Modulate with primary (vertex) color for lighting // @@ -504,9 +499,6 @@ void LLDrawPoolTerrain::renderFull4TU() gGL.getTexUnit(3)->enable(LLTexUnit::TT_TEXTURE); gGL.getTexUnit(3)->activate(); - // Set alpha texture and do lighting modulation - gGL.getTexUnit(3)->setTextureColorBlend(LLTexUnit::TBO_MULT, LLTexUnit::TBS_PREV_COLOR, LLTexUnit::TBS_VERT_COLOR); - gGL.getTexUnit(0)->activate(); // GL_BLEND disabled by default @@ -527,8 +519,6 @@ void LLDrawPoolTerrain::renderFull4TU() glTexGenfv(GL_S, GL_OBJECT_PLANE, tp0.mV); glTexGenfv(GL_T, GL_OBJECT_PLANE, tp1.mV); - gGL.getTexUnit(0)->setTextureColorBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_TEX_COLOR); - // // Stage 1: Generate alpha ramp for detail2/detail3 transition // @@ -542,7 +532,6 @@ void LLDrawPoolTerrain::renderFull4TU() gGL.translatef(-2.f, 0.f, 0.f); // Care about alpha only - gGL.getTexUnit(1)->setTextureColorBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_PREV_COLOR); gGL.getTexUnit(1)->setTextureAlphaBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_TEX_ALPHA); // @@ -559,8 +548,6 @@ void LLDrawPoolTerrain::renderFull4TU() glTexGenfv(GL_S, GL_OBJECT_PLANE, tp0.mV); glTexGenfv(GL_T, GL_OBJECT_PLANE, tp1.mV); - gGL.getTexUnit(2)->setTextureColorBlend(LLTexUnit::TBO_LERP_PREV_ALPHA, LLTexUnit::TBS_TEX_COLOR, LLTexUnit::TBS_PREV_COLOR); - // // Stage 3: Generate alpha ramp for detail1/detail2 transition // @@ -575,7 +562,6 @@ void LLDrawPoolTerrain::renderFull4TU() gGL.matrixMode(LLRender::MM_MODELVIEW); // Set alpha texture and do lighting modulation - gGL.getTexUnit(3)->setTextureColorBlend(LLTexUnit::TBO_MULT, LLTexUnit::TBS_PREV_COLOR, LLTexUnit::TBS_VERT_COLOR); gGL.getTexUnit(3)->setTextureAlphaBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_TEX_ALPHA); gGL.getTexUnit(0)->activate(); @@ -665,8 +651,6 @@ void LLDrawPoolTerrain::renderFull2TU() glTexGenfv(GL_S, GL_OBJECT_PLANE, tp0.mV); glTexGenfv(GL_T, GL_OBJECT_PLANE, tp1.mV); - gGL.getTexUnit(0)->setTextureColorBlend(LLTexUnit::TBO_MULT, LLTexUnit::TBS_TEX_COLOR, LLTexUnit::TBS_VERT_COLOR); - drawLoop(); //---------------------------------------------------------------------------- @@ -681,7 +665,6 @@ void LLDrawPoolTerrain::renderFull2TU() glDisable(GL_TEXTURE_GEN_T); // Care about alpha only - gGL.getTexUnit(0)->setTextureColorBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_PREV_COLOR); gGL.getTexUnit(0)->setTextureAlphaBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_TEX_ALPHA); @@ -699,7 +682,6 @@ void LLDrawPoolTerrain::renderFull2TU() glTexGenfv(GL_S, GL_OBJECT_PLANE, tp0.mV); glTexGenfv(GL_T, GL_OBJECT_PLANE, tp1.mV); - gGL.getTexUnit(1)->setTextureColorBlend(LLTexUnit::TBO_MULT, LLTexUnit::TBS_TEX_COLOR, LLTexUnit::TBS_VERT_COLOR); gGL.getTexUnit(1)->setTextureAlphaBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_PREV_ALPHA); gGL.getTexUnit(0)->activate(); @@ -722,7 +704,6 @@ void LLDrawPoolTerrain::renderFull2TU() gGL.matrixMode(LLRender::MM_MODELVIEW); // Care about alpha only - gGL.getTexUnit(0)->setTextureColorBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_PREV_COLOR); gGL.getTexUnit(0)->setTextureAlphaBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_TEX_ALPHA); // @@ -739,7 +720,6 @@ void LLDrawPoolTerrain::renderFull2TU() glTexGenfv(GL_S, GL_OBJECT_PLANE, tp0.mV); glTexGenfv(GL_T, GL_OBJECT_PLANE, tp1.mV); - gGL.getTexUnit(1)->setTextureColorBlend(LLTexUnit::TBO_MULT, LLTexUnit::TBS_TEX_COLOR, LLTexUnit::TBS_VERT_COLOR); gGL.getTexUnit(1)->setTextureAlphaBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_PREV_ALPHA); { @@ -762,7 +742,6 @@ void LLDrawPoolTerrain::renderFull2TU() gGL.matrixMode(LLRender::MM_MODELVIEW); // Care about alpha only - gGL.getTexUnit(0)->setTextureColorBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_PREV_COLOR); gGL.getTexUnit(0)->setTextureAlphaBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_TEX_ALPHA); // Stage 1: Write detail3 @@ -777,7 +756,6 @@ void LLDrawPoolTerrain::renderFull2TU() glTexGenfv(GL_S, GL_OBJECT_PLANE, tp0.mV); glTexGenfv(GL_T, GL_OBJECT_PLANE, tp1.mV); - gGL.getTexUnit(1)->setTextureColorBlend(LLTexUnit::TBO_MULT, LLTexUnit::TBS_TEX_COLOR, LLTexUnit::TBS_VERT_COLOR); gGL.getTexUnit(1)->setTextureAlphaBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_PREV_ALPHA); gGL.getTexUnit(0)->activate(); @@ -837,8 +815,6 @@ void LLDrawPoolTerrain::renderSimple() 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); - drawLoop(); //---------------------------------------------------------------------------- diff --git a/indra/newview/lldrawpoolwater.cpp b/indra/newview/lldrawpoolwater.cpp index 4023d59776..53aca91e5c 100644 --- a/indra/newview/lldrawpoolwater.cpp +++ b/indra/newview/lldrawpoolwater.cpp @@ -239,7 +239,6 @@ void LLDrawPoolWater::render(S32 pass) glTexGenfv(GL_S, GL_OBJECT_PLANE, tp0); glTexGenfv(GL_T, GL_OBJECT_PLANE, tp1); - gGL.getTexUnit(1)->setTextureColorBlend(LLTexUnit::TBO_MULT, LLTexUnit::TBS_TEX_COLOR, LLTexUnit::TBS_PREV_COLOR); gGL.getTexUnit(1)->setTextureAlphaBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_PREV_ALPHA); gGL.getTexUnit(0)->activate(); diff --git a/indra/newview/llviewerjointmesh.cpp b/indra/newview/llviewerjointmesh.cpp index 640e54c2e1..f3b0e82b3a 100644 --- a/indra/newview/llviewerjointmesh.cpp +++ b/indra/newview/llviewerjointmesh.cpp @@ -265,7 +265,6 @@ U32 LLViewerJointMesh::drawShape( F32 pixelArea, BOOL first_pass, BOOL is_dummy) else { gGL.diffuseColor4f(0.7f, 0.6f, 0.3f, 1.f); - gGL.getTexUnit(diffuse_channel)->setTextureColorBlend(LLTexUnit::TBO_LERP_TEX_ALPHA, LLTexUnit::TBS_TEX_COLOR, LLTexUnit::TBS_PREV_COLOR); } } else if( !is_dummy && layerset ) -- cgit v1.2.3 From fab60f242ef7e3aac299c8373f486cb9fa92494c Mon Sep 17 00:00:00 2001 From: Dave Houlton Date: Tue, 30 Nov 2021 12:06:23 -0700 Subject: SL-16386 purge no-op fxn LLTexUnit::setTextureAlphaBlend() --- indra/llrender/llrender.h | 4 ---- indra/newview/lldrawpoolbump.cpp | 2 -- indra/newview/lldrawpoolterrain.cpp | 25 ------------------------- indra/newview/lldrawpoolwater.cpp | 2 -- 4 files changed, 33 deletions(-) (limited to 'indra') diff --git a/indra/llrender/llrender.h b/indra/llrender/llrender.h index 08a906a89b..d594c455d6 100644 --- a/indra/llrender/llrender.h +++ b/indra/llrender/llrender.h @@ -198,10 +198,6 @@ public: // make sure you want to permanently change the filtering for the bound texture. void setTextureFilteringOption(LLTexUnit::eTextureFilterOptions option); - // 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); */ } - static U32 getInternalType(eTextureType type); U32 getCurrTexture(void) { return mCurrTexture; } diff --git a/indra/newview/lldrawpoolbump.cpp b/indra/newview/lldrawpoolbump.cpp index 6fd6fc06c6..cd4aada822 100644 --- a/indra/newview/lldrawpoolbump.cpp +++ b/indra/newview/lldrawpoolbump.cpp @@ -402,8 +402,6 @@ void LLDrawPoolBump::bindCubeMap(LLGLSLShader* shader, S32 shader_level, S32& di gGL.getTexUnit(0)->disable(); cube_map->enable(0); gGL.getTexUnit(0)->bind(cube_map); - - gGL.getTexUnit(0)->setTextureAlphaBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_VERT_ALPHA); } } } diff --git a/indra/newview/lldrawpoolterrain.cpp b/indra/newview/lldrawpoolterrain.cpp index 5db816d003..adea1909a3 100644 --- a/indra/newview/lldrawpoolterrain.cpp +++ b/indra/newview/lldrawpoolterrain.cpp @@ -475,9 +475,6 @@ void LLDrawPoolTerrain::renderFull4TU() gGL.getTexUnit(1)->enable(LLTexUnit::TT_TEXTURE); gGL.getTexUnit(1)->activate(); - // Care about alpha only - gGL.getTexUnit(1)->setTextureAlphaBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_TEX_ALPHA); - // // Stage 2: Interpolate detail1 with existing based on ramp // @@ -531,9 +528,6 @@ void LLDrawPoolTerrain::renderFull4TU() gGL.loadIdentity(); gGL.translatef(-2.f, 0.f, 0.f); - // Care about alpha only - gGL.getTexUnit(1)->setTextureAlphaBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_TEX_ALPHA); - // // Stage 2: Interpolate detail2 with existing based on ramp // @@ -561,9 +555,6 @@ void LLDrawPoolTerrain::renderFull4TU() gGL.translatef(-1.f, 0.f, 0.f); gGL.matrixMode(LLRender::MM_MODELVIEW); - // Set alpha texture and do lighting modulation - gGL.getTexUnit(3)->setTextureAlphaBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_TEX_ALPHA); - gGL.getTexUnit(0)->activate(); { LLGLEnable blend(GL_BLEND); @@ -664,10 +655,6 @@ void LLDrawPoolTerrain::renderFull2TU() glDisable(GL_TEXTURE_GEN_S); glDisable(GL_TEXTURE_GEN_T); - // Care about alpha only - gGL.getTexUnit(0)->setTextureAlphaBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_TEX_ALPHA); - - // // Stage 1: Write detail1 // @@ -682,8 +669,6 @@ void LLDrawPoolTerrain::renderFull2TU() glTexGenfv(GL_S, GL_OBJECT_PLANE, tp0.mV); glTexGenfv(GL_T, GL_OBJECT_PLANE, tp1.mV); - gGL.getTexUnit(1)->setTextureAlphaBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_PREV_ALPHA); - gGL.getTexUnit(0)->activate(); { LLGLEnable blend(GL_BLEND); @@ -703,9 +688,6 @@ void LLDrawPoolTerrain::renderFull2TU() gGL.translatef(-1.f, 0.f, 0.f); gGL.matrixMode(LLRender::MM_MODELVIEW); - // Care about alpha only - gGL.getTexUnit(0)->setTextureAlphaBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_TEX_ALPHA); - // // Stage 1: Write detail2 // @@ -720,8 +702,6 @@ void LLDrawPoolTerrain::renderFull2TU() glTexGenfv(GL_S, GL_OBJECT_PLANE, tp0.mV); glTexGenfv(GL_T, GL_OBJECT_PLANE, tp1.mV); - gGL.getTexUnit(1)->setTextureAlphaBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_PREV_ALPHA); - { LLGLEnable blend(GL_BLEND); drawLoop(); @@ -741,9 +721,6 @@ void LLDrawPoolTerrain::renderFull2TU() gGL.translatef(-2.f, 0.f, 0.f); gGL.matrixMode(LLRender::MM_MODELVIEW); - // Care about alpha only - gGL.getTexUnit(0)->setTextureAlphaBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_TEX_ALPHA); - // Stage 1: Write detail3 gGL.getTexUnit(1)->bind(detail_texture3p); gGL.getTexUnit(1)->enable(LLTexUnit::TT_TEXTURE); @@ -756,8 +733,6 @@ void LLDrawPoolTerrain::renderFull2TU() glTexGenfv(GL_S, GL_OBJECT_PLANE, tp0.mV); glTexGenfv(GL_T, GL_OBJECT_PLANE, tp1.mV); - gGL.getTexUnit(1)->setTextureAlphaBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_PREV_ALPHA); - gGL.getTexUnit(0)->activate(); { LLGLEnable blend(GL_BLEND); diff --git a/indra/newview/lldrawpoolwater.cpp b/indra/newview/lldrawpoolwater.cpp index 53aca91e5c..590385472b 100644 --- a/indra/newview/lldrawpoolwater.cpp +++ b/indra/newview/lldrawpoolwater.cpp @@ -239,8 +239,6 @@ void LLDrawPoolWater::render(S32 pass) glTexGenfv(GL_S, GL_OBJECT_PLANE, tp0); glTexGenfv(GL_T, GL_OBJECT_PLANE, tp1); - gGL.getTexUnit(1)->setTextureAlphaBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_PREV_ALPHA); - gGL.getTexUnit(0)->activate(); glClearStencil(1); -- cgit v1.2.3 From 4d6963bd812b45c713ab83d5e90367e04d3ab5b1 Mon Sep 17 00:00:00 2001 From: Dave Houlton Date: Tue, 30 Nov 2021 12:37:51 -0700 Subject: SL-16386 purge write-only state member LLCubeMap::mTextureCoordStage --- indra/llrender/llcubemap.cpp | 12 ------------ indra/llrender/llcubemap.h | 3 --- indra/newview/lldrawpoolbump.cpp | 2 -- 3 files changed, 17 deletions(-) (limited to 'indra') diff --git a/indra/llrender/llcubemap.cpp b/indra/llrender/llcubemap.cpp index d2faa5f3ae..834084674e 100644 --- a/indra/llrender/llcubemap.cpp +++ b/indra/llrender/llcubemap.cpp @@ -47,7 +47,6 @@ bool LLCubeMap::sUseCubeMaps = true; LLCubeMap::LLCubeMap(bool init_as_srgb) : mTextureStage(0), - mTextureCoordStage(0), mMatrixStage(0), mIssRGB(init_as_srgb) { @@ -180,7 +179,6 @@ void LLCubeMap::bind() void LLCubeMap::enable(S32 stage) { enableTexture(stage); - enableTextureCoords(stage); } void LLCubeMap::enableTexture(S32 stage) @@ -192,15 +190,9 @@ void LLCubeMap::enableTexture(S32 stage) } } -void LLCubeMap::enableTextureCoords(S32 stage) -{ - mTextureCoordStage = stage; -} - void LLCubeMap::disable(void) { disableTexture(); - disableTextureCoords(); } void LLCubeMap::disableTexture(void) @@ -215,10 +207,6 @@ void LLCubeMap::disableTexture(void) } } -void LLCubeMap::disableTextureCoords(void) -{ -} - void LLCubeMap::setMatrix(S32 stage) { mMatrixStage = stage; diff --git a/indra/llrender/llcubemap.h b/indra/llrender/llcubemap.h index 95b6d12099..a01636d8d4 100644 --- a/indra/llrender/llcubemap.h +++ b/indra/llrender/llcubemap.h @@ -48,12 +48,10 @@ public: void enable(S32 stage); void enableTexture(S32 stage); - void enableTextureCoords(S32 stage); S32 getStage(void) { return mTextureStage; } void disable(void); void disableTexture(void); - void disableTextureCoords(void); void setMatrix(S32 stage); void restoreMatrix(); void setReflection (void); @@ -80,7 +78,6 @@ protected: LLPointer mImages[6]; LLPointer mRawImages[6]; S32 mTextureStage; - S32 mTextureCoordStage; S32 mMatrixStage; }; diff --git a/indra/newview/lldrawpoolbump.cpp b/indra/newview/lldrawpoolbump.cpp index cd4aada822..9d19ff44db 100644 --- a/indra/newview/lldrawpoolbump.cpp +++ b/indra/newview/lldrawpoolbump.cpp @@ -383,7 +383,6 @@ void LLDrawPoolBump::bindCubeMap(LLGLSLShader* shader, S32 shader_level, S32& di // the cube map in the one pass shiny shaders cube_channel = shader->enableTexture(LLViewerShaderMgr::ENVIRONMENT_MAP, LLTexUnit::TT_CUBE_MAP); cube_map->enableTexture(cube_channel); - cube_map->enableTextureCoords(1); diffuse_channel = shader->enableTexture(LLViewerShaderMgr::DIFFUSE_MAP); } else @@ -534,7 +533,6 @@ void LLDrawPoolBump::beginFullbrightShiny() gGL.getTexUnit(1)->disable(); cube_channel = shader->enableTexture(LLViewerShaderMgr::ENVIRONMENT_MAP, LLTexUnit::TT_CUBE_MAP); cube_map->enableTexture(cube_channel); - cube_map->enableTextureCoords(1); diffuse_channel = shader->enableTexture(LLViewerShaderMgr::DIFFUSE_MAP); gGL.getTexUnit(cube_channel)->bind(cube_map); -- cgit v1.2.3 From 8b92652806ddc239e8d2627151ce2dab6faf138f Mon Sep 17 00:00:00 2001 From: Dave Houlton Date: Tue, 30 Nov 2021 12:53:17 -0700 Subject: SL-16386 replace gutted LLRender::setAlphaRejectSettings() with explicit flush() --- indra/llrender/llrender.cpp | 7 +------ indra/llrender/llrender.h | 2 -- indra/newview/lldrawpool.cpp | 2 +- indra/newview/lldrawpoolsimple.cpp | 4 ++-- indra/newview/lldrawpooltree.cpp | 4 ++-- indra/newview/llface.cpp | 2 +- indra/newview/llnetmap.cpp | 4 ++-- indra/newview/llselectmgr.cpp | 4 +--- indra/newview/lltoolmorph.cpp | 4 ++-- indra/newview/llvoavatar.cpp | 10 +++++----- indra/newview/llworldmapview.cpp | 9 +++------ 11 files changed, 20 insertions(+), 32 deletions(-) (limited to 'indra') diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp index 14abd9b83e..c426c769f3 100644 --- a/indra/llrender/llrender.cpp +++ b/indra/llrender/llrender.cpp @@ -926,7 +926,7 @@ void LLRender::refreshState(void) setColorMask(mCurrColorMask[0], mCurrColorMask[1], mCurrColorMask[2], mCurrColorMask[3]); - setAlphaRejectSettings(mCurrAlphaFunc, mCurrAlphaFuncVal); + flush(); mDirty = false; } @@ -1429,11 +1429,6 @@ void LLRender::setSceneBlendType(eBlendType type) } } -void LLRender::setAlphaRejectSettings(eCompareFunc func, F32 value) -{ - flush(); -} - void LLRender::blendFunc(eBlendFactor sfactor, eBlendFactor dfactor) { llassert(sfactor < BF_UNDEF); diff --git a/indra/llrender/llrender.h b/indra/llrender/llrender.h index d594c455d6..cdf4075244 100644 --- a/indra/llrender/llrender.h +++ b/indra/llrender/llrender.h @@ -431,8 +431,6 @@ public: void setColorMask(bool writeColorR, bool writeColorG, bool writeColorB, bool writeAlpha); void setSceneBlendType(eBlendType type); - void setAlphaRejectSettings(eCompareFunc func, F32 value = 0.01f); - // applies blend func to both color and alpha void blendFunc(eBlendFactor sfactor, eBlendFactor dfactor); // applies separate blend functions to color and alpha diff --git a/indra/newview/lldrawpool.cpp b/indra/newview/lldrawpool.cpp index 92a9bed504..bad0c66fb1 100644 --- a/indra/newview/lldrawpool.cpp +++ b/indra/newview/lldrawpool.cpp @@ -493,7 +493,7 @@ void LLRenderPass::pushRiggedMaskBatches(U32 type, U32 mask, BOOL texture, BOOL } else { - gGL.setAlphaRejectSettings(LLRender::CF_GREATER, pparams->mAlphaMaskCutoff); + gGL.flush(); } if (lastAvatar != pparams->mAvatar || lastMeshId != pparams->mSkinInfo->mHash) diff --git a/indra/newview/lldrawpoolsimple.cpp b/indra/newview/lldrawpoolsimple.cpp index ca4e20ae9b..a1d769bc83 100644 --- a/indra/newview/lldrawpoolsimple.cpp +++ b/indra/newview/lldrawpoolsimple.cpp @@ -591,7 +591,7 @@ void LLDrawPoolGrass::beginRenderPass(S32 pass) } else { - gGL.setAlphaRejectSettings(LLRender::CF_GREATER, 0.5f); + gGL.flush(); LLGLSLShader::bindNoShader(); } } @@ -607,7 +607,7 @@ void LLDrawPoolGrass::endRenderPass(S32 pass) } else { - gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT); + gGL.flush(); } } diff --git a/indra/newview/lldrawpooltree.cpp b/indra/newview/lldrawpooltree.cpp index e93852864e..c84178c6cd 100644 --- a/indra/newview/lldrawpooltree.cpp +++ b/indra/newview/lldrawpooltree.cpp @@ -77,7 +77,7 @@ void LLDrawPoolTree::beginRenderPass(S32 pass) else { gPipeline.enableLightsDynamic(); - gGL.setAlphaRejectSettings(LLRender::CF_GREATER, 0.5f); + gGL.flush(); } } @@ -134,7 +134,7 @@ void LLDrawPoolTree::endRenderPass(S32 pass) if (mShaderLevel <= 0) { - gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT); + gGL.flush(); } } diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp index 39ca7961d8..54a043482b 100644 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -653,7 +653,7 @@ void LLFace::renderOneWireframe(const LLColor4 &color, F32 fogCfx, bool wirefram glFogf(GL_FOG_END, d*(1 + (LLViewerCamera::getInstance()->getView() / LLViewerCamera::getInstance()->getDefaultFOV()))); glFogfv(GL_FOG_COLOR, fogCol.mV); - gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT); + gGL.flush(); { gGL.diffuseColor4f(color.mV[VRED], color.mV[VGREEN], color.mV[VBLUE], 0.4f); renderFace(mDrawablep, this); diff --git a/indra/newview/llnetmap.cpp b/indra/newview/llnetmap.cpp index 111b45612e..937f36b6fc 100644 --- a/indra/newview/llnetmap.cpp +++ b/indra/newview/llnetmap.cpp @@ -259,7 +259,7 @@ void LLNetMap::draw() gGL.end(); // Draw water - gGL.setAlphaRejectSettings(LLRender::CF_GREATER, ABOVE_WATERLINE_ALPHA / 255.f); + gGL.flush(); { if (regionp->getLand().getWaterTexture()) { @@ -276,7 +276,7 @@ void LLNetMap::draw() gGL.end(); } } - gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT); + gGL.flush(); } // Redraw object layer periodically diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp index 6f136e50e0..b3d3e9e0da 100644 --- a/indra/newview/llselectmgr.cpp +++ b/indra/newview/llselectmgr.cpp @@ -5894,8 +5894,6 @@ void LLSelectMgr::updateSilhouettes() LLViewerObject* objectp = *iter; objectp->clearChanged(LLXform::MOVED | LLXform::SILHOUETTE); } - - //gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT); } void LLSelectMgr::updateSelectionSilhouette(LLObjectSelectionHandle object_handle, S32& num_sils_genned, std::vector& changed_objects) @@ -6620,7 +6618,7 @@ void LLSelectNode::renderOneSilhouette(const LLColor4 &color) glFogfv(GL_FOG_COLOR, fogCol.mV); LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE, GL_GEQUAL); - gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT); + gGL.flush(); gGL.begin(LLRender::LINES); { gGL.color4f(color.mV[VRED], color.mV[VGREEN], color.mV[VBLUE], 0.4f); diff --git a/indra/newview/lltoolmorph.cpp b/indra/newview/lltoolmorph.cpp index 9f0198029a..b2e8348ffd 100644 --- a/indra/newview/lltoolmorph.cpp +++ b/indra/newview/lltoolmorph.cpp @@ -244,11 +244,11 @@ BOOL LLVisualParamHint::render() { LLDrawPoolAvatar *avatarPoolp = (LLDrawPoolAvatar *)gAgentAvatarp->mDrawable->getFace(0)->getPool(); LLGLDepthTest gls_depth(GL_TRUE, GL_TRUE); - gGL.setAlphaRejectSettings(LLRender::CF_ALWAYS); + gGL.flush(); gGL.setSceneBlendType(LLRender::BT_REPLACE); avatarPoolp->renderAvatars(gAgentAvatarp); // renders only one avatar gGL.setSceneBlendType(LLRender::BT_ALPHA); - gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT); + gGL.flush(); } gAgentAvatarp->setVisualParamWeight(mVisualParam->getID(), mLastParamWeight); mWearablePtr->setVisualParamWeight(mVisualParam->getID(), mLastParamWeight); diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index da856beb6e..8e4e008738 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -5114,21 +5114,21 @@ U32 LLVOAvatar::renderTransparent(BOOL first_pass) U32 num_indices = 0; if( isWearingWearableType( LLWearableType::WT_SKIRT ) && (isUIAvatar() || isTextureVisible(TEX_SKIRT_BAKED)) ) { - gGL.setAlphaRejectSettings(LLRender::CF_GREATER, 0.25f); + gGL.flush(); LLViewerJoint* skirt_mesh = getViewerJoint(MESH_ID_SKIRT); if (skirt_mesh) { num_indices += skirt_mesh->render(mAdjustedPixelArea, FALSE); } first_pass = FALSE; - gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT); + gGL.flush(); } if (!isSelf() || gAgent.needsRenderHead() || LLPipeline::sShadowRender) { if (LLPipeline::sImpostorRender) { - gGL.setAlphaRejectSettings(LLRender::CF_GREATER, 0.5f); + gGL.flush(); } if (isTextureVisible(TEX_HEAD_BAKED)) @@ -5151,7 +5151,7 @@ U32 LLVOAvatar::renderTransparent(BOOL first_pass) } if (LLPipeline::sImpostorRender) { - gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT); + gGL.flush(); } } @@ -5247,7 +5247,7 @@ U32 LLVOAvatar::renderImpostor(LLColor4U color, S32 diffuse_channel) } { LLGLEnable test(GL_ALPHA_TEST); - gGL.setAlphaRejectSettings(LLRender::CF_GREATER, 0.f); + gGL.flush(); gGL.color4ubv(color.mV); gGL.getTexUnit(diffuse_channel)->bind(&mImpostor); diff --git a/indra/newview/llworldmapview.cpp b/indra/newview/llworldmapview.cpp index a6df079223..59ac4554d7 100644 --- a/indra/newview/llworldmapview.cpp +++ b/indra/newview/llworldmapview.cpp @@ -321,22 +321,19 @@ void LLWorldMapView::draw() // Clear the background alpha to 0 gGL.flush(); gGL.setColorMask(false, true); - gGL.setAlphaRejectSettings(LLRender::CF_GREATER_EQUAL, 0.f); + gGL.flush(); gGL.setSceneBlendType(LLRender::BT_REPLACE); gGL.color4f(0.0f, 0.0f, 0.0f, 0.0f); gl_rect_2d(0, height, width, 0); } gGL.flush(); - - gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT); gGL.setColorMask(true, true); // Draw the image tiles drawMipmap(width, height); gGL.flush(); - gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT); gGL.setColorMask(true, true); // Draw per sim overlayed information (names, mature, offline...) @@ -480,13 +477,13 @@ void LLWorldMapView::draw() LLGLSUIDefault gls_ui; { gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - gGL.setAlphaRejectSettings(LLRender::CF_GREATER_EQUAL, 0.f); + gGL.flush(); gGL.blendFunc(LLRender::BF_ONE_MINUS_DEST_ALPHA, LLRender::BF_DEST_ALPHA); gGL.color4fv( mBackgroundColor.mV ); gl_rect_2d(0, height, width, 0); } - gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT); + gGL.flush(); gGL.setSceneBlendType(LLRender::BT_ALPHA); // Draw item infos if we're not zoomed out too much and there's something to draw -- cgit v1.2.3 From 08f0f6d8330e0eb654e1661f8c661d5222992933 Mon Sep 17 00:00:00 2001 From: Dave Houlton Date: Tue, 30 Nov 2021 15:01:40 -0700 Subject: SL-16386 remove references to (const true) LLPipeline::mVertexShadersEnabled --- indra/newview/llviewershadermgr.cpp | 220 ++++++++++++++++++------------------ indra/newview/llviewerwindow.cpp | 6 - indra/newview/pipeline.cpp | 6 +- indra/newview/pipeline.h | 2 - 4 files changed, 110 insertions(+), 124 deletions(-) (limited to 'indra') diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp index d37678e24f..26592adc0a 100644 --- a/indra/newview/llviewershadermgr.cpp +++ b/indra/newview/llviewershadermgr.cpp @@ -558,164 +558,162 @@ void LLViewerShaderMgr::setShaders() return; } - gPipeline.mVertexShadersEnabled = TRUE; - gPipeline.mVertexShadersLoaded = 1; + gPipeline.mVertexShadersLoaded = 1; - // Load all shaders to set max levels - loaded = loadShadersEnvironment(); + // Load all shaders to set max levels + loaded = loadShadersEnvironment(); + if (loaded) + { + LL_INFOS() << "Loaded environment shaders." << LL_ENDL; + } + else + { + LL_WARNS() << "Failed to load environment shaders." << LL_ENDL; + llassert(loaded); + } + + if (loaded) + { + loaded = loadShadersWater(); if (loaded) { - LL_INFOS() << "Loaded environment shaders." << LL_ENDL; + LL_INFOS() << "Loaded water shaders." << LL_ENDL; } else { - LL_WARNS() << "Failed to load environment shaders." << LL_ENDL; + LL_WARNS() << "Failed to load water shaders." << LL_ENDL; llassert(loaded); } + } + if (loaded) + { + loaded = loadShadersWindLight(); if (loaded) { - loaded = loadShadersWater(); - if (loaded) - { - LL_INFOS() << "Loaded water shaders." << LL_ENDL; - } - else - { - LL_WARNS() << "Failed to load water shaders." << LL_ENDL; - llassert(loaded); - } + LL_INFOS() << "Loaded windlight shaders." << LL_ENDL; } - - if (loaded) + else { - loaded = loadShadersWindLight(); - if (loaded) - { - LL_INFOS() << "Loaded windlight shaders." << LL_ENDL; - } - else - { - LL_WARNS() << "Failed to load windlight shaders." << LL_ENDL; - llassert(loaded); - } + LL_WARNS() << "Failed to load windlight shaders." << LL_ENDL; + llassert(loaded); } + } + if (loaded) + { + loaded = loadShadersEffects(); if (loaded) { - loaded = loadShadersEffects(); - if (loaded) - { - LL_INFOS() << "Loaded effects shaders." << LL_ENDL; - } - else - { - LL_WARNS() << "Failed to load effects shaders." << LL_ENDL; - llassert(loaded); - } + LL_INFOS() << "Loaded effects shaders." << LL_ENDL; } - - if (loaded) + else { - loaded = loadShadersInterface(); - if (loaded) - { - LL_INFOS() << "Loaded interface shaders." << LL_ENDL; - } - else - { - LL_WARNS() << "Failed to load interface shaders." << LL_ENDL; - llassert(loaded); - } + LL_WARNS() << "Failed to load effects shaders." << LL_ENDL; + llassert(loaded); } + } + if (loaded) + { + loaded = loadShadersInterface(); if (loaded) - { - loaded = loadTransformShaders(); - if (loaded) - { - LL_INFOS() << "Loaded transform shaders." << LL_ENDL; - } - else - { - LL_WARNS() << "Failed to load transform shaders." << LL_ENDL; - llassert(loaded); - } + LL_INFOS() << "Loaded interface shaders." << LL_ENDL; + } + else + { + LL_WARNS() << "Failed to load interface shaders." << LL_ENDL; + llassert(loaded); } + } + if (loaded) + + { + loaded = loadTransformShaders(); if (loaded) { - // Load max avatar shaders to set the max level - mShaderLevel[SHADER_AVATAR] = 3; - mMaxAvatarShaderLevel = 3; + LL_INFOS() << "Loaded transform shaders." << LL_ENDL; + } + else + { + LL_WARNS() << "Failed to load transform shaders." << LL_ENDL; + llassert(loaded); + } + } + + if (loaded) + { + // Load max avatar shaders to set the max level + mShaderLevel[SHADER_AVATAR] = 3; + mMaxAvatarShaderLevel = 3; if (loadShadersObject()) - { //hardware skinning is enabled and rigged attachment shaders loaded correctly - BOOL avatar_cloth = gSavedSettings.getBOOL("RenderAvatarCloth"); + { //hardware skinning is enabled and rigged attachment shaders loaded correctly + BOOL avatar_cloth = gSavedSettings.getBOOL("RenderAvatarCloth"); - // cloth is a class3 shader - S32 avatar_class = avatar_cloth ? 3 : 1; + // cloth is a class3 shader + S32 avatar_class = avatar_cloth ? 3 : 1; - // Set the actual level - mShaderLevel[SHADER_AVATAR] = avatar_class; + // Set the actual level + mShaderLevel[SHADER_AVATAR] = avatar_class; - loaded = loadShadersAvatar(); - llassert(loaded); + loaded = loadShadersAvatar(); + llassert(loaded); - if (mShaderLevel[SHADER_AVATAR] != avatar_class) + if (mShaderLevel[SHADER_AVATAR] != avatar_class) + { + if(llmax(mShaderLevel[SHADER_AVATAR]-1,0) >= 3) { - if(llmax(mShaderLevel[SHADER_AVATAR]-1,0) >= 3) - { - avatar_cloth = true; - } - else - { - avatar_cloth = false; - } - gSavedSettings.setBOOL("RenderAvatarCloth", avatar_cloth); + avatar_cloth = true; } + else + { + avatar_cloth = false; + } + gSavedSettings.setBOOL("RenderAvatarCloth", avatar_cloth); } - else - { //hardware skinning not possible, neither is deferred rendering - mShaderLevel[SHADER_AVATAR] = 0; - mShaderLevel[SHADER_DEFERRED] = 0; + } + else + { //hardware skinning not possible, neither is deferred rendering + 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 + loadShadersAvatar(); // unloads - loaded = loadShadersObject(); - llassert(loaded); - } + loaded = loadShadersObject(); + llassert(loaded); } + } - if (!loaded) - { //some shader absolutely could not load, try to fall back to a simpler setting - if (gSavedSettings.getBOOL("WindLightUseAtmosShaders")) - { //disable windlight and try again - gSavedSettings.setBOOL("WindLightUseAtmosShaders", FALSE); - LL_WARNS() << "Falling back to no windlight shaders." << LL_ENDL; - reentrance = false; - setShaders(); - return; - } - } - - llassert(loaded); - - if (loaded && !loadShadersDeferred()) - { //everything else succeeded but deferred failed, disable deferred and try again - gSavedSettings.setBOOL("RenderDeferred", FALSE); - LL_WARNS() << "Falling back to no deferred shaders." << LL_ENDL; + if (!loaded) + { //some shader absolutely could not load, try to fall back to a simpler setting + if (gSavedSettings.getBOOL("WindLightUseAtmosShaders")) + { //disable windlight and try again + gSavedSettings.setBOOL("WindLightUseAtmosShaders", FALSE); + LL_WARNS() << "Falling back to no windlight shaders." << LL_ENDL; reentrance = false; setShaders(); return; } + } + + llassert(loaded); + + if (loaded && !loadShadersDeferred()) + { //everything else succeeded but deferred failed, disable deferred and try again + gSavedSettings.setBOOL("RenderDeferred", FALSE); + LL_WARNS() << "Falling back to no deferred shaders." << LL_ENDL; + reentrance = false; + setShaders(); + return; + } - // gPipeline.mVertexShadersEnabled = FALSE; // gPipeline.mVertexShadersLoaded = 0; if (gViewerWindow) diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 10631afd13..6462ec019b 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -608,12 +608,6 @@ public: { LLTrace::Recording& last_frame_recording = LLTrace::get_frame_recording().getLastRecording(); - if (gPipeline.getUseVertexShaders() == 0) - { - addText(xpos, ypos, "Shaders Disabled"); - ypos += y_inc; - } - if (gGLManager.mHasATIMemInfo) { S32 meminfo[4]; diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 8881b78593..63e101a290 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -376,7 +376,6 @@ LLPipeline::LLPipeline() : mNumVisibleFaces(0), mInitialized(false), - mVertexShadersEnabled(false), mVertexShadersLoaded(0), mTransformFeedbackPrimitives(0), mRenderDebugFeatureMask(0), @@ -1364,10 +1363,7 @@ void LLPipeline::restoreGL() { assertInitialized(); - if (mVertexShadersEnabled) - { - LLViewerShaderMgr::instance()->setShaders(); - } + LLViewerShaderMgr::instance()->setShaders(); for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin(); iter != LLWorld::getInstance()->getRegionList().end(); ++iter) diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h index d82f8bd64b..50a730077e 100644 --- a/indra/newview/pipeline.h +++ b/indra/newview/pipeline.h @@ -226,7 +226,6 @@ public: S32 getMaxLightingDetail() const; void setUseVertexShaders(bool use_shaders); - bool getUseVertexShaders() const { return mVertexShadersEnabled; } bool canUseVertexShaders(); bool canUseWindLightShaders() const; bool canUseWindLightShadersOnObjects() const; @@ -702,7 +701,6 @@ public: LLVector4 mTransformedMoonDir; bool mInitialized; - bool mVertexShadersEnabled; S32 mVertexShadersLoaded; // 0 = no, 1 = yes, -1 = failed U32 mTransformFeedbackPrimitives; //number of primitives expected to be generated by transform feedback -- cgit v1.2.3 From 7a5ef999d01b05dd1574004d167dbd693cc56d1d Mon Sep 17 00:00:00 2001 From: Dave Houlton Date: Tue, 30 Nov 2021 15:32:54 -0700 Subject: SL-16386 consolidate all VertexShader capability checks to a single LLPipeline::shadersLoaded() --- indra/newview/lldrawpoolavatar.cpp | 6 +++--- indra/newview/lldrawpoolbump.cpp | 4 ++-- indra/newview/lldrawpooltree.cpp | 2 +- indra/newview/lldrawpoolwlsky.cpp | 2 +- indra/newview/llviewershadermgr.cpp | 6 ++---- indra/newview/llviewerstats.cpp | 2 +- indra/newview/llvovolume.cpp | 6 +++--- indra/newview/pipeline.cpp | 27 +++++++++------------------ indra/newview/pipeline.h | 5 ++--- 9 files changed, 24 insertions(+), 36 deletions(-) (limited to 'indra') diff --git a/indra/newview/lldrawpoolavatar.cpp b/indra/newview/lldrawpoolavatar.cpp index f9fdbac9ab..fa67b9902d 100644 --- a/indra/newview/lldrawpoolavatar.cpp +++ b/indra/newview/lldrawpoolavatar.cpp @@ -516,7 +516,7 @@ void LLDrawPoolAvatar::beginRigid() { LL_PROFILE_ZONE_SCOPED - if (gPipeline.canUseVertexShaders()) + if (gPipeline.shadersLoaded()) { if (LLPipeline::sUnderWaterRender) { @@ -664,7 +664,7 @@ void LLDrawPoolAvatar::beginSkinned() } else { - if(gPipeline.canUseVertexShaders()) + if(gPipeline.shadersLoaded()) { // software skinning, use a basic shader for windlight. // TODO: find a better fallback method for software skinning. @@ -698,7 +698,7 @@ void LLDrawPoolAvatar::endSkinned() } else { - if(gPipeline.canUseVertexShaders()) + if(gPipeline.shadersLoaded()) { // software skinning, use a basic shader for windlight. // TODO: find a better fallback method for software skinning. diff --git a/indra/newview/lldrawpoolbump.cpp b/indra/newview/lldrawpoolbump.cpp index 9d19ff44db..dc52fc7680 100644 --- a/indra/newview/lldrawpoolbump.cpp +++ b/indra/newview/lldrawpoolbump.cpp @@ -1510,7 +1510,7 @@ void LLDrawPoolInvisible::render(S32 pass) { //render invisiprims LL_RECORD_BLOCK_TIME(FTM_RENDER_INVISIBLE); - if (gPipeline.canUseVertexShaders()) + if (gPipeline.shadersLoaded()) { gOcclusionProgram.bind(); } @@ -1522,7 +1522,7 @@ void LLDrawPoolInvisible::render(S32 pass) gGL.setColorMask(true, false); glStencilMask(0xFFFFFFFF); - if (gPipeline.canUseVertexShaders()) + if (gPipeline.shadersLoaded()) { gOcclusionProgram.unbind(); } diff --git a/indra/newview/lldrawpooltree.cpp b/indra/newview/lldrawpooltree.cpp index c84178c6cd..ac957f1cbd 100644 --- a/indra/newview/lldrawpooltree.cpp +++ b/indra/newview/lldrawpooltree.cpp @@ -68,7 +68,7 @@ void LLDrawPoolTree::beginRenderPass(S32 pass) shader = &gTreeProgram; } - if (gPipeline.canUseVertexShaders()) + if (gPipeline.shadersLoaded()) { shader->bind(); shader->setMinimumAlpha(0.5f); diff --git a/indra/newview/lldrawpoolwlsky.cpp b/indra/newview/lldrawpoolwlsky.cpp index 44b12ceaca..80a65947f6 100644 --- a/indra/newview/lldrawpoolwlsky.cpp +++ b/indra/newview/lldrawpoolwlsky.cpp @@ -460,7 +460,7 @@ void LLDrawPoolWLSky::renderHeavenlyBodies() LLFace * face = gSky.mVOSkyp->mFace[LLVOSky::FACE_SUN]; F32 blend_factor = LLEnvironment::instance().getCurrentSky()->getBlendFactor(); - bool can_use_vertex_shaders = gPipeline.canUseVertexShaders(); + bool can_use_vertex_shaders = gPipeline.shadersLoaded(); bool can_use_windlight_shaders = gPipeline.canUseWindLightShaders(); diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp index 26592adc0a..8669abf284 100644 --- a/indra/newview/llviewershadermgr.cpp +++ b/indra/newview/llviewershadermgr.cpp @@ -558,7 +558,7 @@ void LLViewerShaderMgr::setShaders() return; } - gPipeline.mVertexShadersLoaded = 1; + gPipeline.mShadersLoaded = true; // Load all shaders to set max levels loaded = loadShadersEnvironment(); @@ -714,8 +714,6 @@ void LLViewerShaderMgr::setShaders() return; } - // gPipeline.mVertexShadersLoaded = 0; - if (gViewerWindow) { gViewerWindow->setCursor(UI_CURSOR_ARROW); @@ -845,7 +843,7 @@ void LLViewerShaderMgr::unloadShaders() mShaderLevel[SHADER_WINDLIGHT] = 0; mShaderLevel[SHADER_TRANSFORM] = 0; - gPipeline.mVertexShadersLoaded = 0; + gPipeline.mShadersLoaded = false; } BOOL LLViewerShaderMgr::loadBasicShaders() diff --git a/indra/newview/llviewerstats.cpp b/indra/newview/llviewerstats.cpp index 1fda2fb20e..37b6244635 100644 --- a/indra/newview/llviewerstats.cpp +++ b/indra/newview/llviewerstats.cpp @@ -541,7 +541,7 @@ void send_viewer_stats(bool include_preferences) { shader_level = 2; } - else if (gPipeline.canUseVertexShaders()) + else if (gPipeline.shadersLoaded()) { shader_level = 1; } diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 464e6efd2e..2f554bc9b8 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -6567,7 +6567,7 @@ U32 LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFace { registerFace(group, facep, LLRenderPass::PASS_ALPHA); } - else if (gPipeline.canUseVertexShaders() + else if (gPipeline.shadersLoaded() && LLPipeline::sRenderBump && te->getShiny() && can_be_shiny) @@ -6602,7 +6602,7 @@ U32 LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFace registerFace(group, facep, LLRenderPass::PASS_ALPHA); } } - else if (gPipeline.canUseVertexShaders() + else if (gPipeline.shadersLoaded() && LLPipeline::sRenderBump && te->getShiny() && can_be_shiny) @@ -6683,7 +6683,7 @@ U32 LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFace } - if (!gPipeline.canUseVertexShaders() && + if (!gPipeline.shadersLoaded() && !is_alpha && te->getShiny() && LLPipeline::sRenderBump) diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 63e101a290..c122b4f43e 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -376,7 +376,7 @@ LLPipeline::LLPipeline() : mNumVisibleFaces(0), mInitialized(false), - mVertexShadersLoaded(0), + mShadersLoaded(false), mTransformFeedbackPrimitives(0), mRenderDebugFeatureMask(0), mRenderDebugMask(0), @@ -737,7 +737,7 @@ void LLPipeline::resizeShadowTexture() void LLPipeline::resizeScreenTexture() { - if (gPipeline.canUseVertexShaders() && assertInitialized()) + if (gPipeline.shadersLoaded()) { GLuint resX = gViewerWindow->getWorldViewWidthRaw(); GLuint resY = gViewerWindow->getWorldViewHeightRaw(); @@ -748,8 +748,8 @@ void LLPipeline::resizeScreenTexture() releaseShadowTargets(); allocateScreenBuffer(resX,resY); gResizeScreenTexture = FALSE; - } - } + } + } } void LLPipeline::allocatePhysicsBuffer() @@ -1380,17 +1380,9 @@ void LLPipeline::restoreGL() } } - -bool LLPipeline::canUseVertexShaders() +bool LLPipeline::shadersLoaded() { - if ((assertInitialized() && mVertexShadersLoaded != 1) ) - { - return false; - } - else - { - return true; - } + return (assertInitialized() && mShadersLoaded); } bool LLPipeline::canUseWindLightShaders() const @@ -1413,8 +1405,7 @@ bool LLPipeline::canUseAntiAliasing() const void LLPipeline::unloadShaders() { LLViewerShaderMgr::instance()->unloadShaders(); - - mVertexShadersLoaded = 0; + mShadersLoaded = false; } void LLPipeline::assertInitializedDoError() @@ -2351,7 +2342,7 @@ void LLPipeline::updateCull(LLCamera& camera, LLCullResult& result, S32 water_cl sCull->clear(); - bool to_texture = LLPipeline::sUseOcclusion > 1 && gPipeline.canUseVertexShaders(); + bool to_texture = LLPipeline::sUseOcclusion > 1 && gPipeline.shadersLoaded(); if (to_texture) { @@ -2385,7 +2376,7 @@ void LLPipeline::updateCull(LLCamera& camera, LLCullResult& result, S32 water_cl LLGLDepthTest depth(GL_TRUE, GL_FALSE); bool bound_shader = false; - if (gPipeline.canUseVertexShaders() && LLGLSLShader::sCurBoundShader == 0) + if (gPipeline.shadersLoaded() && LLGLSLShader::sCurBoundShader == 0) { //if no shader is currently bound, use the occlusion shader instead of fixed function if we can // (shadow render uses a special shader that clamps to clip planes) bound_shader = true; diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h index 50a730077e..3ac3e3ce01 100644 --- a/indra/newview/pipeline.h +++ b/indra/newview/pipeline.h @@ -225,8 +225,7 @@ public: S32 getLightingDetail() const { return mLightingDetail; } S32 getMaxLightingDetail() const; - void setUseVertexShaders(bool use_shaders); - bool canUseVertexShaders(); + bool shadersLoaded(); bool canUseWindLightShaders() const; bool canUseWindLightShadersOnObjects() const; bool canUseAntiAliasing() const; @@ -701,7 +700,7 @@ public: LLVector4 mTransformedMoonDir; bool mInitialized; - S32 mVertexShadersLoaded; // 0 = no, 1 = yes, -1 = failed + bool mShadersLoaded; U32 mTransformFeedbackPrimitives; //number of primitives expected to be generated by transform feedback protected: -- cgit v1.2.3 From abd7d80048529fd971e1b65ea3afe0f7e78bd356 Mon Sep 17 00:00:00 2001 From: Dave Houlton Date: Tue, 30 Nov 2021 17:15:27 -0700 Subject: SL-16386 skip void return --- indra/newview/llvosurfacepatch.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'indra') diff --git a/indra/newview/llvosurfacepatch.cpp b/indra/newview/llvosurfacepatch.cpp index 8fbecbc7d7..b0af565867 100644 --- a/indra/newview/llvosurfacepatch.cpp +++ b/indra/newview/llvosurfacepatch.cpp @@ -60,7 +60,6 @@ public: void setupVertexBuffer(U32 data_mask) { LLVertexBuffer::setupVertexBuffer(data_mask & ~(MAP_TEXCOORD2 | MAP_TEXCOORD3)); - return; } }; -- cgit v1.2.3