diff options
24 files changed, 21 insertions, 409 deletions
diff --git a/indra/llappearance/lltexlayer.cpp b/indra/llappearance/lltexlayer.cpp index e1a3a83841..473fd078cd 100644 --- a/indra/llappearance/lltexlayer.cpp +++ b/indra/llappearance/lltexlayer.cpp @@ -385,7 +385,6 @@ BOOL LLTexLayerSet::render( S32 x, S32 y, S32 width, S32 height, LLRenderTarget* // clear buffer area to ensure we don't pick up UI elements { gGL.flush(); - LLGLDisable no_alpha(GL_ALPHA_TEST); gAlphaMaskProgram.setMinimumAlpha(0.0f); gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); gGL.color4f( 0.f, 0.f, 0.f, 1.f ); @@ -419,7 +418,6 @@ BOOL LLTexLayerSet::render( S32 x, S32 y, S32 width, S32 height, LLRenderTarget* gGL.flush(); gGL.setSceneBlendType(LLRender::BT_REPLACE); - LLGLDisable no_alpha(GL_ALPHA_TEST); gAlphaMaskProgram.setMinimumAlpha(0.f); gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); @@ -510,7 +508,6 @@ 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); gAlphaMaskProgram.setMinimumAlpha(0.f); gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); gGL.color4f( 0.f, 0.f, 0.f, 1.f ); @@ -1059,7 +1056,6 @@ void LLTexLayer::calculateTexLayerColor(const param_color_list_t ¶m_list, LL BOOL LLTexLayer::render(S32 x, S32 y, S32 width, S32 height, LLRenderTarget* bound_target) { - LLGLEnable color_mat(GL_COLOR_MATERIAL); // *TODO: Is this correct? //gPipeline.disableLights(); stop_glerror(); @@ -1146,7 +1142,6 @@ BOOL LLTexLayer::render(S32 x, S32 y, S32 width, S32 height, LLRenderTarget* bou if( tex ) { bool no_alpha_test = getInfo()->mWriteAllChannels; - LLGLDisable alpha_test(no_alpha_test ? GL_ALPHA_TEST : 0); if (no_alpha_test) { gAlphaMaskProgram.setMinimumAlpha(0.f); @@ -1196,7 +1191,6 @@ BOOL LLTexLayer::render(S32 x, S32 y, S32 width, S32 height, LLRenderTarget* bou getInfo()->mStaticImageFileName.empty() && color_specified ) { - LLGLDisable no_alpha(GL_ALPHA_TEST); gAlphaMaskProgram.setMinimumAlpha(0.000f); gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); @@ -1295,7 +1289,6 @@ BOOL LLTexLayer::blendAlphaTexture(S32 x, S32 y, S32 width, S32 height) LLGLTexture* tex = LLTexLayerStaticImageList::getInstance()->getTexture( getInfo()->mStaticImageFileName, getInfo()->mStaticImageIsMask ); if( tex ) { - LLGLSNoAlphaTest gls_no_alpha_test; gAlphaMaskProgram.setMinimumAlpha(0.f); gGL.getTexUnit(0)->bind(tex, TRUE); gl_rect_2d_simple_tex( width, height ); @@ -1314,7 +1307,6 @@ BOOL LLTexLayer::blendAlphaTexture(S32 x, S32 y, S32 width, S32 height) LLGLTexture* tex = mLocalTextureObject->getImage(); if (tex) { - LLGLSNoAlphaTest gls_no_alpha_test; gAlphaMaskProgram.setMinimumAlpha(0.f); gGL.getTexUnit(0)->bind(tex); gl_rect_2d_simple_tex( width, height ); @@ -1351,7 +1343,6 @@ void LLTexLayer::renderMorphMasks(S32 x, S32 y, S32 width, S32 height, const LLC // Note: if the first param is a mulitply, multiply against the current buffer's alpha if( !first_param || !first_param->getMultiplyBlend() ) { - LLGLDisable no_alpha(GL_ALPHA_TEST); gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); // Clear the alpha @@ -1363,7 +1354,6 @@ void LLTexLayer::renderMorphMasks(S32 x, S32 y, S32 width, S32 height, const LLC } // Accumulate alphas - LLGLSNoAlphaTest gls_no_alpha_test; gGL.color4f( 1.f, 1.f, 1.f, 1.f ); for (param_alpha_list_t::iterator iter = mParamAlphaList.begin(); iter != mParamAlphaList.end(); iter++) { @@ -1386,7 +1376,6 @@ void LLTexLayer::renderMorphMasks(S32 x, S32 y, S32 width, S32 height, const LLC LLGLTexture* tex = mLocalTextureObject->getImage(); if( tex && (tex->getComponents() == 4) ) { - LLGLSNoAlphaTest gls_no_alpha_test; LLTexUnit::eTextureAddressMode old_mode = tex->getAddressMode(); gGL.getTexUnit(0)->bind(tex, TRUE); @@ -1406,7 +1395,6 @@ void LLTexLayer::renderMorphMasks(S32 x, S32 y, S32 width, S32 height, const LLC { if( (tex->getComponents() == 4) || (tex->getComponents() == 1) ) { - LLGLSNoAlphaTest gls_no_alpha_test; gGL.getTexUnit(0)->bind(tex, TRUE); gl_rect_2d_simple_tex( width, height ); gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); @@ -1423,7 +1411,6 @@ void LLTexLayer::renderMorphMasks(S32 x, S32 y, S32 width, S32 height, const LLC // Note: we're still using gGL.blendFunc( GL_DST_ALPHA, GL_ZERO ); if ( !is_approx_equal(layer_color.mV[VW], 1.f) ) { - LLGLDisable no_alpha(GL_ALPHA_TEST); gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); gGL.color4fv(layer_color.mV); gl_rect_2d_simple( width, height ); diff --git a/indra/llappearance/lltexlayerparams.cpp b/indra/llappearance/lltexlayerparams.cpp index 06b4f6c75a..4b537a114f 100644 --- a/indra/llappearance/lltexlayerparams.cpp +++ b/indra/llappearance/lltexlayerparams.cpp @@ -346,7 +346,6 @@ BOOL LLTexLayerParamAlpha::render(S32 x, S32 y, S32 width, S32 height) mCachedProcessedTexture->setAddressMode(LLTexUnit::TAM_CLAMP); } - LLGLSNoAlphaTest gls_no_alpha_test; gGL.getTexUnit(0)->bind(mCachedProcessedTexture); gl_rect_2d_simple_tex(width, height); gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); @@ -363,7 +362,6 @@ BOOL LLTexLayerParamAlpha::render(S32 x, S32 y, S32 width, S32 height) } else { - LLGLDisable no_alpha(GL_ALPHA_TEST); gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); gGL.color4f(0.f, 0.f, 0.f, effective_weight); gl_rect_2d_simple(width, height); diff --git a/indra/llrender/CMakeLists.txt b/indra/llrender/CMakeLists.txt index 92ebdb9490..9454943dc5 100644 --- a/indra/llrender/CMakeLists.txt +++ b/indra/llrender/CMakeLists.txt @@ -18,7 +18,6 @@ set(llrender_SOURCE_FILES llfontgl.cpp llfontregistry.cpp llgl.cpp - llgldbg.cpp llglslshader.cpp llgltexture.cpp llimagegl.cpp @@ -46,7 +45,6 @@ set(llrender_HEADER_FILES llfontbitmapcache.h llfontregistry.h llgl.h - llgldbg.h llglheaders.h llglslshader.h llglstates.h diff --git a/indra/llrender/llgl.cpp b/indra/llrender/llgl.cpp index 303edddfaf..ae408dae4f 100644 --- a/indra/llrender/llgl.cpp +++ b/indra/llrender/llgl.cpp @@ -2454,32 +2454,11 @@ LLGLState::LLGLState(LLGLenum state, S32 enabled) : mState(state), mWasEnabled(FALSE), mIsEnabled(FALSE) { LL_PROFILE_ZONE_SCOPED_CATEGORY_PIPELINE; - 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) { mWasEnabled = sStateMap[state]; - // we can't actually assert on this as queued changes to state are not reflected by glIsEnabled - //llassert(mWasEnabled == glIsEnabled(state)); setEnabled(enabled); - stop_glerror(); } } @@ -2511,7 +2490,6 @@ void LLGLState::setEnabled(S32 enabled) LLGLState::~LLGLState() { LL_PROFILE_ZONE_SCOPED_CATEGORY_PIPELINE; - stop_glerror(); if (mState) { if (gDebugGL) @@ -2544,7 +2522,6 @@ LLGLState::~LLGLState() } } } - stop_glerror(); } //////////////////////////////////////////////////////////////////////////////// @@ -2921,8 +2898,7 @@ void LLGLSyncFence::wait() } LLGLSPipelineSkyBox::LLGLSPipelineSkyBox() -: mAlphaTest(GL_ALPHA_TEST) -, mCullFace(GL_CULL_FACE) +: mCullFace(GL_CULL_FACE) , mSquashClip() { } diff --git a/indra/llrender/llgl.h b/indra/llrender/llgl.h index eb0650d998..4b0fbc0466 100644 --- a/indra/llrender/llgl.h +++ b/indra/llrender/llgl.h @@ -192,13 +192,13 @@ void clear_glerror(); //disable lighting for rendering hud objects //INCORRECT USAGE - LLGLEnable lighting(GL_LIGHTING); + LLGLEnable blend(GL_BLEND); renderHUD(); - LLGLDisable lighting(GL_LIGHTING); + LLGLDisable blend(GL_BLEND); //CORRECT USAGE { - LLGLEnable lighting(GL_LIGHTING); + LLGLEnable blend(GL_BLEND); renderHUD(); } @@ -206,7 +206,7 @@ void clear_glerror(); is useful: { - LLGLEnable lighting(light_hud ? GL_LIGHTING : 0); + LLGLEnable blend(blend_hud ? GL_GL_BLEND: 0); renderHUD(); } diff --git a/indra/llrender/llgldbg.cpp b/indra/llrender/llgldbg.cpp deleted file mode 100644 index 0f1d4ae742..0000000000 --- a/indra/llrender/llgldbg.cpp +++ /dev/null @@ -1,223 +0,0 @@ -/** - * @file llgldbg.cpp - * @brief Definitions for OpenGL debugging support - * - * $LicenseInfo:firstyear=2001&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -// This file sets some global GL parameters, and implements some -// useful functions for GL operations. - -#include "linden_common.h" - -#include "llgldbg.h" - -#include "llgl.h" -#include "llglheaders.h" - - -//------------------------------------------------------------------------ -// cmstr() -//------------------------------------------------------------------------ -const char *cmstr(int i) -{ - switch( i ) - { - case GL_EMISSION: return "GL_EMISSION"; - case GL_AMBIENT: return "GL_AMBIENT"; - case GL_DIFFUSE: return "GL_DIFFUSE"; - case GL_SPECULAR: return "GL_SPECULAR"; - case GL_AMBIENT_AND_DIFFUSE: return "GL_AMBIENT_AND_DIFFUSE"; - } - return "UNKNOWN"; -} - -//------------------------------------------------------------------------ -// facestr() -//------------------------------------------------------------------------ -const char *facestr(int i) -{ - switch( i ) - { - case GL_FRONT: return "GL_FRONT"; - case GL_BACK: return "GL_BACK"; - case GL_FRONT_AND_BACK: return "GL_FRONT_AND_BACK"; - } - return "UNKNOWN"; -} - -//------------------------------------------------------------------------ -// boolstr() -//------------------------------------------------------------------------ -const char *boolstr(int b) -{ - return b ? "GL_TRUE" : "GL_FALSE"; -} - -//------------------------------------------------------------------------ -// fv4() -//------------------------------------------------------------------------ -const char *fv4(F32 *f) -{ - static char str[128]; - sprintf(str, "%8.3f %8.3f %8.3f %8.3f", f[0], f[1], f[2], f[3]); - return str; -} - -//------------------------------------------------------------------------ -// fv3() -//------------------------------------------------------------------------ -const char *fv3(F32 *f) -{ - static char str[128]; /* Flawfinder: ignore */ - snprintf(str, sizeof(str), "%8.3f, %8.3f, %8.3f", f[0], f[1], f[2]); /* Flawfinder: ignore */ - return str; -} - -//------------------------------------------------------------------------ -// fv1() -//------------------------------------------------------------------------ -const char *fv1(F32 *f) -{ - static char str[128]; /* Flawfinder: ignore */ - snprintf(str, sizeof(str), "%8.3f", f[0]); /* Flawfinder: ignore */ - return str; -} - -//------------------------------------------------------------------------ -// llgl_dump() -//------------------------------------------------------------------------ -void llgl_dump() -{ - int i; - F32 fv[16]; - GLboolean b; - - LL_INFOS() << "==========================" << LL_ENDL; - LL_INFOS() << "OpenGL State" << LL_ENDL; - LL_INFOS() << "==========================" << LL_ENDL; - - LL_INFOS() << "-----------------------------------" << LL_ENDL; - LL_INFOS() << "Current Values" << LL_ENDL; - LL_INFOS() << "-----------------------------------" << LL_ENDL; - - glGetFloatv(GL_CURRENT_COLOR, fv); - LL_INFOS() << "GL_CURRENT_COLOR : " << fv4(fv) << LL_ENDL; - - glGetFloatv(GL_CURRENT_NORMAL, fv); - LL_INFOS() << "GL_CURRENT_NORMAL : " << fv3(fv) << LL_ENDL; - - LL_INFOS() << "-----------------------------------" << LL_ENDL; - LL_INFOS() << "Lighting" << LL_ENDL; - LL_INFOS() << "-----------------------------------" << LL_ENDL; - - LL_INFOS() << "GL_LIGHTING : " << boolstr(glIsEnabled(GL_LIGHTING)) << LL_ENDL; - - LL_INFOS() << "GL_COLOR_MATERIAL : " << boolstr(glIsEnabled(GL_COLOR_MATERIAL)) << LL_ENDL; - - glGetIntegerv(GL_COLOR_MATERIAL_PARAMETER, (GLint*)&i); - LL_INFOS() << "GL_COLOR_MATERIAL_PARAMETER: " << cmstr(i) << LL_ENDL; - - glGetIntegerv(GL_COLOR_MATERIAL_FACE, (GLint*)&i); - LL_INFOS() << "GL_COLOR_MATERIAL_FACE : " << facestr(i) << LL_ENDL; - - fv[0] = fv[1] = fv[2] = fv[3] = 12345.6789f; - glGetMaterialfv(GL_FRONT, GL_AMBIENT, fv); - LL_INFOS() << "GL_AMBIENT material : " << fv4(fv) << LL_ENDL; - - fv[0] = fv[1] = fv[2] = fv[3] = 12345.6789f; - glGetMaterialfv(GL_FRONT, GL_DIFFUSE, fv); - LL_INFOS() << "GL_DIFFUSE material : " << fv4(fv) << LL_ENDL; - - fv[0] = fv[1] = fv[2] = fv[3] = 12345.6789f; - glGetMaterialfv(GL_FRONT, GL_SPECULAR, fv); - LL_INFOS() << "GL_SPECULAR material : " << fv4(fv) << LL_ENDL; - - fv[0] = fv[1] = fv[2] = fv[3] = 12345.6789f; - glGetMaterialfv(GL_FRONT, GL_EMISSION, fv); - LL_INFOS() << "GL_EMISSION material : " << fv4(fv) << LL_ENDL; - - fv[0] = fv[1] = fv[2] = fv[3] = 12345.6789f; - glGetMaterialfv(GL_FRONT, GL_SHININESS, fv); - LL_INFOS() << "GL_SHININESS material : " << fv1(fv) << LL_ENDL; - - fv[0] = fv[1] = fv[2] = fv[3] = 12345.6789f; - glGetFloatv(GL_LIGHT_MODEL_AMBIENT, fv); - LL_INFOS() << "GL_LIGHT_MODEL_AMBIENT : " << fv4(fv) << LL_ENDL; - - glGetBooleanv(GL_LIGHT_MODEL_LOCAL_VIEWER, &b); - LL_INFOS() << "GL_LIGHT_MODEL_LOCAL_VIEWER: " << boolstr(b) << LL_ENDL; - - glGetBooleanv(GL_LIGHT_MODEL_TWO_SIDE, &b); - LL_INFOS() << "GL_LIGHT_MODEL_TWO_SIDE : " << boolstr(b) << LL_ENDL; - - for (int l=0; l<8; l++) - { - b = glIsEnabled(GL_LIGHT0+l); - LL_INFOS() << "GL_LIGHT" << l << " : " << boolstr(b) << LL_ENDL; - - if (!b) - continue; - - glGetLightfv(GL_LIGHT0+l, GL_AMBIENT, fv); - LL_INFOS() << " GL_AMBIENT light : " << fv4(fv) << LL_ENDL; - - glGetLightfv(GL_LIGHT0+l, GL_DIFFUSE, fv); - LL_INFOS() << " GL_DIFFUSE light : " << fv4(fv) << LL_ENDL; - - glGetLightfv(GL_LIGHT0+l, GL_SPECULAR, fv); - LL_INFOS() << " GL_SPECULAR light : " << fv4(fv) << LL_ENDL; - - glGetLightfv(GL_LIGHT0+l, GL_POSITION, fv); - LL_INFOS() << " GL_POSITION light : " << fv4(fv) << LL_ENDL; - - glGetLightfv(GL_LIGHT0+l, GL_CONSTANT_ATTENUATION, fv); - LL_INFOS() << " GL_CONSTANT_ATTENUATION : " << fv1(fv) << LL_ENDL; - - glGetLightfv(GL_LIGHT0+l, GL_QUADRATIC_ATTENUATION, fv); - LL_INFOS() << " GL_QUADRATIC_ATTENUATION : " << fv1(fv) << LL_ENDL; - - glGetLightfv(GL_LIGHT0+l, GL_SPOT_DIRECTION, fv); - LL_INFOS() << " GL_SPOT_DIRECTION : " << fv4(fv) << LL_ENDL; - - glGetLightfv(GL_LIGHT0+l, GL_SPOT_EXPONENT, fv); - LL_INFOS() << " GL_SPOT_EXPONENT : " << fv1(fv) << LL_ENDL; - - glGetLightfv(GL_LIGHT0+l, GL_SPOT_CUTOFF, fv); - LL_INFOS() << " GL_SPOT_CUTOFF : " << fv1(fv) << LL_ENDL; - } - - LL_INFOS() << "-----------------------------------" << LL_ENDL; - LL_INFOS() << "Pixel Operations" << LL_ENDL; - LL_INFOS() << "-----------------------------------" << LL_ENDL; - - LL_INFOS() << "GL_ALPHA_TEST : " << boolstr(glIsEnabled(GL_ALPHA_TEST)) << LL_ENDL; - LL_INFOS() << "GL_DEPTH_TEST : " << boolstr(glIsEnabled(GL_DEPTH_TEST)) << LL_ENDL; - - glGetBooleanv(GL_DEPTH_WRITEMASK, &b); - LL_INFOS() << "GL_DEPTH_WRITEMASK : " << boolstr(b) << LL_ENDL; - - LL_INFOS() << "GL_BLEND : " << boolstr(glIsEnabled(GL_BLEND)) << LL_ENDL; - LL_INFOS() << "GL_DITHER : " << boolstr(glIsEnabled(GL_DITHER)) << LL_ENDL; -} - -// End diff --git a/indra/llrender/llgldbg.h b/indra/llrender/llgldbg.h deleted file mode 100644 index 963579cb82..0000000000 --- a/indra/llrender/llgldbg.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * @file llgldbg.h - * @brief Definitions for OpenGL debugging support - * - * $LicenseInfo:firstyear=2001&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#ifndef LL_LLGLDBG_H -#define LL_LLGLDBG_H - -// Dumps the current OpenGL state to the console. -void llgl_dump(); - - -#endif // LL_LLGLDBG_H diff --git a/indra/llrender/llglstates.h b/indra/llrender/llglstates.h index c46585eab4..930c5e3ed7 100644 --- a/indra/llrender/llglstates.h +++ b/indra/llrender/llglstates.h @@ -56,77 +56,44 @@ private: class LLGLSDefault { protected: - LLGLEnable mColorMaterial; - LLGLDisable mAlphaTest, mBlend, mCullFace, mDither, - mLineSmooth, mLineStipple, mNormalize, mPolygonSmooth, - mGLMultisample; + LLGLDisable mBlend, mCullFace; public: LLGLSDefault() : - // Enable - mColorMaterial(GL_COLOR_MATERIAL), // Disable - mAlphaTest(GL_ALPHA_TEST), mBlend(GL_BLEND), - mCullFace(GL_CULL_FACE), - mDither(GL_DITHER), - mLineSmooth(GL_LINE_SMOOTH), - mLineStipple(GL_LINE_STIPPLE), - mNormalize(GL_NORMALIZE), - mPolygonSmooth(GL_POLYGON_SMOOTH), - mGLMultisample(GL_MULTISAMPLE) + mCullFace(GL_CULL_FACE) { } }; class LLGLSObjectSelect { protected: - LLGLDisable mBlend, mAlphaTest; + LLGLDisable mBlend; LLGLEnable mCullFace; public: LLGLSObjectSelect() : mBlend(GL_BLEND), - mAlphaTest(GL_ALPHA_TEST), mCullFace(GL_CULL_FACE) { } }; -class LLGLSObjectSelectAlpha -{ -protected: - LLGLEnable mAlphaTest; -public: - LLGLSObjectSelectAlpha() - : mAlphaTest(GL_ALPHA_TEST) - {} -}; - //---------------------------------------------------------------------------- class LLGLSUIDefault { protected: - LLGLEnable mBlend, mAlphaTest; + LLGLEnable mBlend; LLGLDisable mCullFace; LLGLDepthTest mDepthTest; public: LLGLSUIDefault() - : mBlend(GL_BLEND), mAlphaTest(GL_ALPHA_TEST), + : mBlend(GL_BLEND), mCullFace(GL_CULL_FACE), mDepthTest(GL_FALSE, GL_TRUE, GL_LEQUAL) {} }; -class LLGLSNoAlphaTest // : public LLGLSUIDefault -{ -protected: - LLGLDisable mAlphaTest; -public: - LLGLSNoAlphaTest() - : mAlphaTest(GL_ALPHA_TEST) - {} -}; - //---------------------------------------------------------------------------- class LLGLSPipeline @@ -144,11 +111,10 @@ public: class LLGLSPipelineAlpha // : public LLGLSPipeline { protected: - LLGLEnable mBlend, mAlphaTest; + LLGLEnable mBlend; public: LLGLSPipelineAlpha() - : mBlend(GL_BLEND), - mAlphaTest(GL_ALPHA_TEST) + : mBlend(GL_BLEND) { } }; @@ -162,20 +128,9 @@ public: {} }; -class LLGLSPipelineAvatar -{ -protected: - LLGLEnable mNormalize; -public: - LLGLSPipelineAvatar() - : mNormalize(GL_NORMALIZE) - {} -}; - class LLGLSPipelineSkyBox { protected: - LLGLDisable mAlphaTest; LLGLDisable mCullFace; LLGLSquashToFarClip mSquashClip; public: @@ -201,13 +156,11 @@ public: class LLGLSTracker { protected: - LLGLEnable mCullFace, mBlend, mAlphaTest; + LLGLEnable mCullFace, mBlend; public: LLGLSTracker() : mCullFace(GL_CULL_FACE), - mBlend(GL_BLEND), - mAlphaTest(GL_ALPHA_TEST) - + mBlend(GL_BLEND) { } }; diff --git a/indra/llrender/llrender2dutils.cpp b/indra/llrender/llrender2dutils.cpp index 2d6f3c9469..52869406d2 100644 --- a/indra/llrender/llrender2dutils.cpp +++ b/indra/llrender/llrender2dutils.cpp @@ -712,11 +712,8 @@ 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 ) +void gl_line_3d( const LLVector3& start, const LLVector3& end, const LLColor4& color) { - // Stippled line - LLGLEnable stipple(GL_LINE_STIPPLE); - gGL.color4f(color.mV[VRED], color.mV[VGREEN], color.mV[VBLUE], color.mV[VALPHA]); gGL.flush(); diff --git a/indra/llrender/llrender2dutils.h b/indra/llrender/llrender2dutils.h index 206e68f084..135738c3ba 100644 --- a/indra/llrender/llrender2dutils.h +++ b/indra/llrender/llrender2dutils.h @@ -79,7 +79,7 @@ void gl_draw_scaled_rotated_image(S32 x, S32 y, S32 width, S32 height, F32 degre void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 border_width, S32 border_height, S32 width, S32 height, LLTexture* image, const LLColor4 &color, BOOL solid_color = FALSE, const LLRectf& uv_rect = LLRectf(0.f, 1.f, 1.f, 0.f), bool scale_inner = true); void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 width, S32 height, LLTexture* image, const LLColor4 &color, BOOL solid_color = FALSE, const LLRectf& uv_rect = LLRectf(0.f, 1.f, 1.f, 0.f), const LLRectf& scale_rect = LLRectf(0.f, 1.f, 1.f, 0.f), bool scale_inner = true); -void gl_stippled_line_3d( const LLVector3& start, const LLVector3& end, const LLColor4& color, F32 phase = 0.f ); +void gl_line_3d( const LLVector3& start, const LLVector3& end, const LLColor4& color); void gl_rect_2d_simple_tex( S32 width, S32 height ); diff --git a/indra/newview/lldrawpoolsimple.cpp b/indra/newview/lldrawpoolsimple.cpp index 3cc101b325..a89c9d4561 100644 --- a/indra/newview/lldrawpoolsimple.cpp +++ b/indra/newview/lldrawpoolsimple.cpp @@ -79,7 +79,6 @@ void LLDrawPoolGlow::renderPostDeferred(S32 pass) LLGLSLShader* shader = &gDeferredEmissiveProgram; LLGLEnable blend(GL_BLEND); - LLGLDisable test(GL_ALPHA_TEST); gGL.flush(); /// Get rid of z-fighting with non-glow pass. LLGLEnable polyOffset(GL_POLYGON_OFFSET_FILL); @@ -132,7 +131,6 @@ void LLDrawPoolSimple::renderDeferred(S32 pass) { LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; //LL_RECORD_BLOCK_TIME(FTM_RENDER_SIMPLE_DEFERRED); LLGLDisable blend(GL_BLEND); - LLGLDisable alpha_test(GL_ALPHA_TEST); //render static setup_simple_shader(&gDeferredDiffuseProgram); diff --git a/indra/newview/lldrawpooltree.cpp b/indra/newview/lldrawpooltree.cpp index 57146c432a..9dcbc48697 100644 --- a/indra/newview/lldrawpooltree.cpp +++ b/indra/newview/lldrawpooltree.cpp @@ -71,7 +71,6 @@ void LLDrawPoolTree::renderDeferred(S32 pass) return; } - LLGLState test(GL_ALPHA_TEST, 0); gGL.getTexUnit(sDiffTex)->bindFast(mTexturep); mTexturep->addTextureStats(1024.f * 1024.f); // <=== keep Linden tree textures at full res diff --git a/indra/newview/llfloaterimagepreview.cpp b/indra/newview/llfloaterimagepreview.cpp index 6b0ba44624..ba0f97e2e1 100644 --- a/indra/newview/llfloaterimagepreview.cpp +++ b/indra/newview/llfloaterimagepreview.cpp @@ -251,7 +251,6 @@ void LLFloaterImagePreview::draw() if (selected <= 0) { gl_rect_2d_checkerboard(mPreviewRect); - LLGLDisable gls_alpha(GL_ALPHA_TEST); if(mImagep.notNull()) { diff --git a/indra/newview/llhudnametag.cpp b/indra/newview/llhudnametag.cpp index 0408cfc659..26fc899eb5 100644 --- a/indra/newview/llhudnametag.cpp +++ b/indra/newview/llhudnametag.cpp @@ -258,7 +258,6 @@ void LLHUDNameTag::renderText(BOOL for_select) } LLGLState gls_blend(GL_BLEND, for_select ? FALSE : TRUE); - LLGLState gls_alpha(GL_ALPHA_TEST, for_select ? FALSE : TRUE); LLColor4 shadow_color(0.f, 0.f, 0.f, 1.f); F32 alpha_factor = 1.f; diff --git a/indra/newview/llhudtext.cpp b/indra/newview/llhudtext.cpp index 22dca07096..0b0de18534 100644 --- a/indra/newview/llhudtext.cpp +++ b/indra/newview/llhudtext.cpp @@ -117,7 +117,6 @@ void LLHUDText::renderText() gGL.getTexUnit(0)->enable(LLTexUnit::TT_TEXTURE); LLGLState gls_blend(GL_BLEND, TRUE); - LLGLState gls_alpha(GL_ALPHA_TEST, TRUE); LLColor4 shadow_color(0.f, 0.f, 0.f, 1.f); F32 alpha_factor = 1.f; @@ -575,7 +574,6 @@ void LLHUDText::renderAllHUD() LLGLState::checkStates(); { - LLGLEnable color_mat(GL_COLOR_MATERIAL); LLGLDepthTest depth(GL_FALSE, GL_FALSE); VisibleTextObjectIterator text_it; diff --git a/indra/newview/llmaniprotate.cpp b/indra/newview/llmaniprotate.cpp index 6b9543d433..886abfb132 100644 --- a/indra/newview/llmaniprotate.cpp +++ b/indra/newview/llmaniprotate.cpp @@ -118,7 +118,6 @@ void LLManipRotate::render() gGL.getTexUnit(0)->bind(LLViewerFetchedTexture::sWhiteImagep); LLGLDepthTest gls_depth(GL_TRUE); LLGLEnable gl_blend(GL_BLEND); - LLGLEnable gls_alpha_test(GL_ALPHA_TEST); // You can rotate if you can move LLViewerObject* first_object = mObjectSelection->getFirstMoveableObject(TRUE); diff --git a/indra/newview/llmanipscale.cpp b/indra/newview/llmanipscale.cpp index c15f1da26b..6f685d4e62 100644 --- a/indra/newview/llmanipscale.cpp +++ b/indra/newview/llmanipscale.cpp @@ -212,7 +212,6 @@ void LLManipScale::render() gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); LLGLDepthTest gls_depth(GL_TRUE); LLGLEnable gl_blend(GL_BLEND); - LLGLEnable gls_alpha_test(GL_ALPHA_TEST); LLBBox bbox = LLSelectMgr::getInstance()->getBBoxOfSelection(); if( canAffectSelection() ) @@ -1317,11 +1316,11 @@ void LLManipScale::renderGuidelinesPart( const LLBBox& bbox ) { LLGLDepthTest gls_depth(GL_TRUE); - gl_stippled_line_3d( guideline_start, guideline_end, LLColor4(1.f, 1.f, 1.f, 0.5f) ); + gl_line_3d( guideline_start, guideline_end, LLColor4(1.f, 1.f, 1.f, 0.5f) ); } { LLGLDepthTest gls_depth(GL_FALSE); - gl_stippled_line_3d( guideline_start, guideline_end, LLColor4(1.f, 1.f, 1.f, 0.25f) ); + gl_line_3d( guideline_start, guideline_end, LLColor4(1.f, 1.f, 1.f, 0.25f) ); } } diff --git a/indra/newview/llmaniptranslate.cpp b/indra/newview/llmaniptranslate.cpp index 91f1af8f28..cafb3fef67 100644 --- a/indra/newview/llmaniptranslate.cpp +++ b/indra/newview/llmaniptranslate.cpp @@ -1537,7 +1537,6 @@ void LLManipTranslate::renderSnapGuides() } { - LLGLDisable alpha_test(GL_ALPHA_TEST); //draw black overlay gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); renderGrid(u,v,tiles,0.0f, 0.0f, 0.0f,a*0.16f); @@ -1558,7 +1557,6 @@ void LLManipTranslate::renderSnapGuides() { LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE, GL_GREATER); - LLGLEnable stipple(GL_LINE_STIPPLE); gGL.flush(); switch (mManipPart) @@ -2182,7 +2180,6 @@ void LLManipTranslate::renderArrow(S32 which_arrow, S32 selected_arrow, F32 box_ { gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); LLGLEnable gls_blend(GL_BLEND); - LLGLEnable gls_color_material(GL_COLOR_MATERIAL); for (S32 pass = 1; pass <= 2; pass++) { diff --git a/indra/newview/llmodelpreview.cpp b/indra/newview/llmodelpreview.cpp index 7ae48eef8c..5f910d95c2 100644 --- a/indra/newview/llmodelpreview.cpp +++ b/indra/newview/llmodelpreview.cpp @@ -3096,7 +3096,7 @@ BOOL LLModelPreview::render() S32 width = getWidth(); S32 height = getHeight(); - LLGLSUIDefault def; // GL_BLEND, GL_ALPHA_TEST, GL_CULL_FACE, depth test + LLGLSUIDefault def; LLGLDisable no_blend(GL_BLEND); LLGLEnable cull(GL_CULL_FACE); LLGLDepthTest depth(GL_FALSE); // SL-12781 disable z-buffer to render background color @@ -3301,8 +3301,6 @@ BOOL LLModelPreview::render() gGL.pushMatrix(); gGL.color4fv(PREVIEW_EDGE_COL.mV); - LLGLEnable normalize(GL_NORMALIZE); - if (!mBaseModel.empty() && mVertexBuffer[5].empty()) { genBuffers(-1, skin_weight); diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp index 71dcc56197..dca341e5a2 100644 --- a/indra/newview/llselectmgr.cpp +++ b/indra/newview/llselectmgr.cpp @@ -6288,9 +6288,6 @@ void LLSelectMgr::renderSilhouettes(BOOL for_hud) auto renderMeshSelection_f = [fogCfx, wireframe_selection](LLSelectNode* node, LLViewerObject* objectp, LLColor4 hlColor) { - //Need to because crash on ATI 3800 (and similar cards) MAINT-5018 - LLGLDisable multisample(LLPipeline::RenderFSAASamples > 0 ? GL_MULTISAMPLE : 0); - LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr; if (shader) diff --git a/indra/newview/lltracker.cpp b/indra/newview/lltracker.cpp index ab4ad5817b..4c55ea1fc6 100644 --- a/indra/newview/lltracker.cpp +++ b/indra/newview/lltracker.cpp @@ -588,7 +588,7 @@ void LLTracker::renderBeacon(LLVector3d pos_global, LLVector3 pos_agent = gAgent.getPosAgentFromGlobal(pos_global); - LLGLSTracker gls_tracker; // default+ CULL_FACE + LIGHTING + GL_BLEND + GL_ALPHA_TEST + LLGLSTracker gls_tracker; gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); LLGLDisable cull_face(GL_CULL_FACE); LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE); diff --git a/indra/newview/llviewerjointmesh.cpp b/indra/newview/llviewerjointmesh.cpp index 5ce8f4023d..5d46c695b7 100644 --- a/indra/newview/llviewerjointmesh.cpp +++ b/indra/newview/llviewerjointmesh.cpp @@ -39,7 +39,6 @@ #include "lldrawpoolbump.h" #include "lldynamictexture.h" #include "llface.h" -#include "llgldbg.h" #include "llglheaders.h" #include "llviewertexlayer.h" #include "llviewercamera.h" diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index af65588709..341ef57d8c 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -5112,9 +5112,6 @@ U32 LLVOAvatar::renderSkinned() // render all geometry attached to the skeleton //-------------------------------------------------------------------- - bool should_alpha_mask = shouldAlphaMask(); - LLGLState test(GL_ALPHA_TEST, should_alpha_mask); - BOOL first_pass = TRUE; if (!LLDrawPoolAvatar::sSkipOpaque) { @@ -5164,7 +5161,6 @@ U32 LLVOAvatar::renderSkinned() if (!LLDrawPoolAvatar::sSkipTransparent || LLPipeline::sImpostorRender) { LLGLState blend(GL_BLEND, !mIsDummy); - LLGLState test(GL_ALPHA_TEST, !mIsDummy); num_indices += renderTransparent(first_pass); } @@ -5242,9 +5238,6 @@ U32 LLVOAvatar::renderRigid() return 0; } - bool should_alpha_mask = shouldAlphaMask(); - LLGLState test(GL_ALPHA_TEST, should_alpha_mask); - if (isTextureVisible(TEX_EYES_BAKED) || (getOverallAppearance() == AOA_JELLYDOLL && !isControlAvatar()) || isUIAvatar()) { LLViewerJoint* eyeball_left = getViewerJoint(MESH_ID_EYEBALL_LEFT); @@ -5308,8 +5301,7 @@ U32 LLVOAvatar::renderImpostor(LLColor4U color, S32 diffuse_channel) gGL.flush(); } { - LLGLEnable test(GL_ALPHA_TEST); - gGL.flush(); + gGL.flush(); gGL.color4ubv(color.mV); gGL.getTexUnit(diffuse_channel)->bind(&mImpostor); diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 99deae309d..7f1db9b61e 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -63,7 +63,6 @@ #include "llfeaturemanager.h" #include "llfloatertelehub.h" #include "llfloaterreg.h" -#include "llgldbg.h" #include "llhudmanager.h" #include "llhudnametag.h" #include "llhudtext.h" @@ -2428,7 +2427,6 @@ void LLPipeline::doOcclusion(LLCamera& camera) gGL.setColorMask(false, false); LLGLDisable blend(GL_BLEND); - LLGLDisable test(GL_ALPHA_TEST); gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); LLGLDepthTest depth(GL_TRUE, GL_FALSE); @@ -3742,7 +3740,6 @@ void render_hud_elements() if (!LLPipeline::sReflectionRender && gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_UI)) { - LLGLEnable multisample(LLPipeline::RenderFSAASamples > 0 ? GL_MULTISAMPLE : 0); gViewerWindow->renderSelections(FALSE, FALSE, FALSE); // For HUD version in render_ui_3d() // Draw the tracking overlays @@ -3777,7 +3774,6 @@ void LLPipeline::renderHighlights() // Render highlighted faces. LLGLSPipelineAlpha gls_pipeline_alpha; LLColor4 color(1.f, 1.f, 1.f, 0.5f); - LLGLEnable color_mat(GL_COLOR_MATERIAL); disableLights(); if ((LLViewerShaderMgr::instance()->getShaderLevel(LLViewerShaderMgr::SHADER_INTERFACE) > 0)) @@ -3947,8 +3943,6 @@ void LLPipeline::renderGeomDeferred(LLCamera& camera, bool do_occlusion) } } - LLGLEnable multisample(RenderFSAASamples > 0 ? GL_MULTISAMPLE : 0); - LLVertexBuffer::unbind(); LLGLState::checkStates(); @@ -4055,8 +4049,6 @@ void LLPipeline::renderGeomPostDeferred(LLCamera& camera) LLGLEnable cull(GL_CULL_FACE); - LLGLEnable multisample(RenderFSAASamples > 0 ? GL_MULTISAMPLE : 0); - calcNearbyLights(camera); setupHWLights(); @@ -7140,7 +7132,6 @@ void LLPipeline::generateGlow(LLRenderTarget* src) { LLGLEnable blend_on(GL_BLEND); - LLGLEnable test(GL_ALPHA_TEST); gGL.setSceneBlendType(LLRender::BT_ADD_WITH_ALPHA); @@ -7559,8 +7550,6 @@ void LLPipeline::renderFinalize() enableLightsFullbright(); - LLGLDisable test(GL_ALPHA_TEST); - gGL.setColorMask(true, true); glClearColor(0, 0, 0, 0); @@ -7971,8 +7960,6 @@ void LLPipeline::renderDeferredLighting() LL_PROFILE_ZONE_NAMED_CATEGORY_PIPELINE("deferred"); LLViewerCamera *camera = LLViewerCamera::getInstance(); - LLGLEnable multisample(RenderFSAASamples > 0 ? GL_MULTISAMPLE : 0); - if (gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_HUD)) { gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_HUD); @@ -8133,7 +8120,6 @@ void LLPipeline::renderDeferredLighting() { LLGLDepthTest depth(GL_FALSE); LLGLDisable blend(GL_BLEND); - LLGLDisable test(GL_ALPHA_TEST); // full screen blit mScreenTriangleVB->setBuffer(); |